You need to sign in to do that
Don't have an account?
ketan mehta
Is it possible to check whether the record if modified in before update trigger?
Hi,
I want to check if a record is modified before executing any operation on record in before update trigger.
Regards,
Ketan
I want to check if a record is modified before executing any operation on record in before update trigger.
Regards,
Ketan
You can do something like this
In trigger you can check the old vallue of field in the record and what is new value in the field for the record.
In update trigger you can get this by below code.
If you want list then use below code
List<YourObjectAPINAME> OldRecords = Trigger.old;
List<YourObjectAPINAME> newRecords = Trigger.new;
If you want to get Map then use below code
MAP<Id,YourObjectAPINAME> OldRecords = Trigger.oldMap;
Map<Id,YourObjectAPINAME> newRecords = Trigger.newMap
Below link which help you when you get which vaialbe value in which event;
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables.htm
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm
If it htelps you than please mark it as solution and ENJOY APEX.
http://www.forcexplore.com/2014/03/compare-old-and-new-field-values-in.html
Thanks for ur replies. As a resolution you are checking values manually but I don't want to do that. Is there any way I can compare the old object and new object without writing down the property comparision??