Order Of Execution
Order of Execution in Salesforce
When we save a record with an insert update, or upsert statement salesforce performs the events in order because when the event happens, Order of Execution is very important because they are multiple things tield to a single event and when the event gets fired we need to know which processes is running first and which processes is running last.
Desired to gain proficiency on Salesforce? Explore the blog post to grasp more expertise on Salesforce Training Courses.
The order of execution is in the following order.
- Executes all before triggers.
- System validations are performed.
- Custom validations are performed.
- Saves the record but does not commit
- Executes all after triggers.
- Executes assignment rules
- Executes auto response rules
- Executes workflow rules
- If the record was updated with workflow field updates, fires before and after triggers are more time in addition to standard validations. Custom validation rules are not run again.
- Executes escalation rules
- Commits to the database