Process order for automation rules and Apex triggers
|Knowledge Article Number||000005694|
|Description||When you're implementing processes that will automate tasks or jobs that need to be performed it always helps to know the order that they'll be processed. We'll go over the logic that is followed.|
1. Old record loaded from database (or initialized for new inserts)
2. New record values overwrite old values
3. System Validation Rules (If inserting Opportunity Products, Custom Validation Rules will also fire in addition to System Validation Rules)
4. All Apex before triggers (EE / UE only)
5. Custom Validation Rules
6. Record saved to database (but not committed)
7. Record reloaded from database
8. All Apex after triggers (EE / UE only)
9. Assignment rules
10. Auto-response rules
11. Workflow rules
13. Escalation rules
14. Parent Rollup Summary Formula value updated (if present)
15. Database commit
16. Post-commit logic (sending email)
NOTE: There's no way to control the order of execution within each group above.
Workflow field updates that run based on an approval process or time-dependent action don't trigger any rules.
Formula fields don't execute in this way. They calculate and display their results in real-time whenever the field is accessed in any way. For example, if a Workflow Rule uses a Formula Field in its criteria or formula, the formula field is evaluated when the Workflow Rule criteria is checked.