Trigger context variables in salesforce

Trigger context variables in salesforce, Apex Triggers in salesforce,sfdcpanda, sfdc panda, salesforce basics, basics of salesforce, apex triggers, salesforce examples, apex example, visualforce examples, apex visualforce, salesforce training, online training salesforce, salesforce job market

Trigger context variables in salesforce

All Triggers define implicit variables that allow developers to access run-time context. These variables are contained in the System.Trigger class.

Context Variables with before and after triggers:

          Trigger Event  Context Variables
Before Insert New
Before Update Old, New, NewMap, OldMap
Before Delete Old, Oldmap
Before Undelete There is a record, it has the field isDeleted set to True. So an undelete trigger wouldn’t be able to see the records that it needs.Because of this reason there is no before undelete operation available.
After Insert New, NewMap
After Update Old, New, NewMap, OldMap
After Delete Old, OldMap

v45.0 Update :

From version 45.0 onwards, salesforce included operationType variable which returns an enum of type System.TriggerOperation corresponding to the current operation. Possible values of the System.TriggerOperation enum are: BEFORE_INSERT, BEFORE_UPDATE, BEFORE_DELETE,AFTER_INSERT, AFTER_UPDATE, AFTER_DELETE, and AFTER_UNDELETE. If you vary your programming logic based on different trigger types, consider using the switch statement with different permutations of unique trigger execution enum states.

Be the first to comment

Leave a Reply

Your email address will not be published.


*