We, being developers, very much aware about automation tools like process builders, Workflows, triggers etc, but ignore what is their order of execution. Before designing any functionality, one should understand the order of execution Salesforce has defined. Here I have listed down the order of execution in most simple way so that it will be helpful to remember.
- Loads a record : User fills the information and hit on save button, Salesforce loads this information to perform further actions.
- System validation rules : If user is entering information directly from UI, following checks are applied
- Layout-specific rules
- Required values
- Field formats
- Maximum field length
- Custom Validation rules : validation rules present on the object.
- Before Triggers : All before insert, before update, before delete triggers.
- Duplicate Rules.
- Saves into database : Record is saved into database (not commited). ID of record is generated in this step.
- After Triggers : All after insert, after update, after delete, after undelete triggers are executed.
- Assignment Rules.
- Auto-response Rules.
- Workflow Rules : If any field is updated with workflow, validation rules are not fired again. But before and after triggers are fired again.
- Process builder flows : All custom validation rules and triggers related to object are fired again.
- Escalation Rules
- Entitlement Rules
- Rollup summary calculation : if there is roll up summary calculation happening on parent record, it also goes through save procedure (Same order of execution performed for parent record)
- Criteria based sharing rules.
- Commit record information to database
It’s hard to remember all the steps in sequence, so you can try by remebering the abbrevations. Like I remember this as VBD – AAA – WP – EE – RCC
- V (Validations) B (Before Triggers) D (Deplicate Rules)
- A (After Triggers) A (Assignment Rules) A (Auto Response Rules)
- W (Workflows) P (Process Builder Flows)
- E (Escalation Rules) E (Entitlement Rules)
- R (Rollup Summary) C (Criteria based sharing rules) C (Commit to database)
This is the most common question in any Salesforce interview process, so if you are looking for any job change, I suggest you should know this order or execution.
if you want more detailed explaination, Salesforce has already posted detailed explaination of the order of execution, you can check it out here.
This is helpful but the thing is as you wrote AAA it’s quite difficult to remember what 1st A and then 2 and next so can we have some alternative abbreviations for this..just a suggestion
Thanks for your feedback, However I dont see any other seperation we can have to remember the order. Let us know if you have any other way to remember in better way.