+ Start a Discussion
BpositiveBpositive 

Formula doubt

I have a lookup of 10 items. Each item has a cost. And there is a quantity of each item which is packed.

I want to find total cost, i.e cost of item1*quantity of item 1 + cost of item 2* quantity of item 2 and so on..

Please help me out.

 

Thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
AravindBabu512AravindBabu512

Hi,

 

You can have a validation rule to perform this check. You can check if the previous value is not blank (This will check if the field was set previously) and previous value <> current value (This will check if the value is changed), if the condition evaluates to TRUE you can show the error message that the field cannot be edited as it is already set.

 

Thanks,

Aravind.

All Answers

Jia HuJia Hu
You can use Roll-Up Summary Field for Master-detail relation.

In the case of Lookup, no standard way to do this.

This post may help:
Roll-Up Summary Fields with Lookup Relationships
http://blog.jeffdouglas.com/2009/07/30/roll-up-summary-fields-with-lookup-relationships-part-1/
BpositiveBpositive

thank you Jia Hu. I will try to do it. I hope it works.

BpositiveBpositive

I have one more query. How can I make a field unchangeable once its value is set?

For eg. if I have a barcode number as a field in an object, how can I ensure that once I enter the barcode number, it cannot be changed?

Hence, if I or any other user changes the barcode number associated with the same object, they should not be allowed to. 

Please reply.

Thank in advance

AravindBabu512AravindBabu512

Hi,

 

You can have a validation rule to perform this check. You can check if the previous value is not blank (This will check if the field was set previously) and previous value <> current value (This will check if the value is changed), if the condition evaluates to TRUE you can show the error message that the field cannot be edited as it is already set.

 

Thanks,

Aravind.

This was selected as the best answer
BpositiveBpositive

Dear Jia Hu,

Summary fields only work with Master Detail. But I cannot have Master Detail since the fields are not mandatory. Can you suggest another way to do it?

 

Thank you

 

~VK