Record-triggered flows in the save order of execution
Key Takeaway
A before-save flow updates the triggering record and runs immediately before Apex before triggers. Use an after-save flow for anything a before-save flow can't do.
A record-triggered flow runs automatically when someone creates, updates, or deletes a record. Each save follows a fixed sequence of automation called the order of execution, and record-triggered flows run at two points in it: before the record is saved (before-save) and after it is saved (after-save). Where a flow sits in that sequence decides what it can see, what it can change, and which other automation runs before or after it.
The order of execution
Here is what happens during a save, in order:
- Salesforce loads the record and the new field values and runs system validation.
- Before-save flows run.
- Apex before triggers run.
- System validation runs again, along with custom validation rules.
- Duplicate rules run.
- Salesforce saves the record to the database without committing it yet.
- After triggers run.
- These rules run:
- Assignment rules
- Auto-response rules
- Workflow rules
- Escalation rules
- Process Builder processes and flows launched by workflow rules run.
- After-save flows run.
- Salesforce runs entitlement rules, roll-up summary calculations, and criteria-based sharing evaluation.
- Salesforce commits all DML operations.