function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
harry63harry63 

can anyone explain trigger.ola and trigger.oldmap

hello every one can anyone explain  and define   trigger.old and trigger.oldmap in detail.because i didnt find anywhere

thanks

harry

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

Trigger.old is the collection of the records being operated on in the trigger operation that represent what the database had at the time the operation initiated and does not reflect any changes being made in the context of the operation, hence the "old" values.

 

Trigger.oldMap returns the same collection as above as a map of id => sobject instead of an array. This is useful when you iterate over the collection of trigger.new (in an update) and need to quickly correlate the new record (with values as the user changed them) with the old image.