I have scenario 1 - A formula field on Account (custom_type__c) which references the Contact's email as - Primary_Contact__r.Email
Whenever Primary Contact's email id is changed , Custom Type is updated on Account, which fires account trigger. However, Trigger.Old doesn't retain the old values.
Example- If Primary Contact's email id is [email protected] , Custom Type on [email protected]. Now, email id of Primary Contact's is updated to [email protected] , so Custom Type on Account0 [email protected] , which fires account trigger. When I print below-
System.debug('In After Update NEW ' + a.custom_type__c);
System.debug('In After Update Old ' + Trigger.OldMap.get(a.Id).custom_type__c)
Both the above statements [email protected] . 1)Why Trigger.OldMap() doesn't retain the old values?
I have scenario 2- I have changed the reference of the same formula field(custom_type__c) to the account name.Now Custom_Type__c = Name (Refers name of the account), in this case Trigger.OldMap retains the old values of the name.Why does it retain in scenario 2 but not in scenario 1?
custom_type__c
is a formula field. Changes to the values of formula fields do not fire triggers. Is this value updated by a trigger, or perhaps a workflow rule or process?