You need to sign in to do that
Don't have an account?
CvrK
On what event does trigger.Oldmap is available?
Hi Everyone,
trigger.Newmap is available only for Before update,aftrer update and after insert triggers,
and Trigger.oldmap is available for Update and delete triggers but wondering is that for all events like Before update,after update,before delete and after delete or only on specific events like mentioned for trigger.newmap
trigger.Newmap is available only for Before update,aftrer update and after insert triggers,
and Trigger.oldmap is available for Update and delete triggers but wondering is that for all events like Before update,after update,before delete and after delete or only on specific events like mentioned for trigger.newmap
Please go through below points and let me know if this helps you.
Trigger.new and Trigger.NewMap
In After insert and after update triggger.new collection will holds latest values and this collection is read olny means we can't modify record data using this collection .
Howevere we can take record Id of curret record and query it again from DB and will perform update operation if require.
Trigger.new is not available in delete trigger
Trigger.new is availabe in after undelete Trigger.
Trigger.old and Trigger.oldMap
In Before Insert Trigger.old collection is not able, it's null.
Trigger.old trigger is available in after update trigger and will hold old copy of current modifying record.
Trigger.old is available in Delete trigger .
http://www.sfdc99.com/2014/01/25/use-vs-triggers/
http://www.infallibletechie.com/2013/02/before-trigger-in-case-of-validation.html
http://www.iterativelogic.com/salesforce-apex-trigger-best-practices/
Please let us know if this will help you
Thanks
Amit Chaudhary