+ Start a Discussion
Prasanth Reddy MPrasanth Reddy M 

How to make fields from lookup objects which are mapped to a custom object will not get updated when there is an update for the lookup object?

Hi Guys,

Have exposed account object's 3 fields to a custom object with the help of lookup relationship of account with the custom object. I just want to ensure any changes for these 3 fields in the Account object should not overwrite the values initial values in custom object when the record created for the first time.

How can we achieve this?
Ariel GorfinkelAriel Gorfinkel
How did you expose the fields?
Did you make formula fields at the custom object, or did you use a workflow / trigger to update fields at the custom object?
Ariel GorfinkelAriel Gorfinkel
If you are using a workflow, you can choose to activate it only upon creation of a new object.
If you are using a trigger, you can copy the values at an "before insert" event.
Prasanth Reddy MPrasanth Reddy M
Yes...I am using formula fields to map the Account name and 2 other fields to the custom object.. I just want to ensure any updates to these fields in Account page including "Account name" should not overwrite the fields in custom object.
Ariel GorfinkelAriel Gorfinkel
With formulas, whatever happens on the account will be reflected on the custom object.
You need to manually update the fields (new fields that are not formula) when you create an instance of the object.
You can do that, as I mentioned before with workflows or triggers.
Prasanth Reddy MPrasanth Reddy M
Ariel - with the help of a trigger, is it possible to prevent the updation of account fields in the custom object by comparing old and new values of those field before and after update ?
Ariel GorfinkelAriel Gorfinkel
If you replaced the formula fields with "regular" fields, then it goes the other way around - meaning you update only when you require (like, upon insertion of a new instance of the custom object).
This is true for both triggers and workflows.
You cannot change values of formula fields, as they update automatically (as soon as the value they reference is changed).
Do you need a trigger example?
Ariel GorfinkelAriel Gorfinkel
You cannot prevent formula fields from updating according to the fields they reference.