Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger oldValues on account(after update){ for(account acc : trigger.new){ //oldvalues string oldphone = trigger.oldmap.get(acc.id).phone; system.debug('==oldphone=='+oldphone); //New values string newphone = acc.phone; system.debug('==newphone=='+newphone); } }
trigger updateAccount on account(before update){ for(account a: trigger.new){ a.Name = trigger.oldmap.get(a.id).Name; } }
trigger updateAccount on account(before update){ for(account a: trigger.new){ If(a.Name != trigger.oldmap.get(a.id).Name){ a.Name = trigger.oldmap.get(a.id).Name; } } }
Please check once below sample code:
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
Salesforce Freelance Consultant/Developer/Administrator
@For Salesforce Project Support: varaprasad4sfdc@gmail.com
Salesforce latest interview questions :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
Just copy old value in same field in trigger.new.