The Salesforce order of execution is the canonical answer to “what happens when a record is saved?” Every senior interview eventually circles back to this list — it’s the single most-asked deep question on the platform.
The order, in 2026
- Load the original record from the database (or initialize a new one)
- Load new field values from the request and overlay them
- System validation — required fields, max lengths, foreign keys
- Apex
beforetriggers execute - Custom validation rules evaluate (and run system validation again on any layout-based required fields)
- Duplicate rules run; if a record is blocked, the save aborts
- The record is saved to the database — but not yet committed
- Apex
aftertriggers execute - Assignment rules (Lead/Case) run
- Auto-response rules (Lead/Case) run
- Workflow rules evaluate and fire
- If field updates fire, before/after triggers run AGAIN on those updates (once per workflow field-update cascade)
- Processes and flows (Process Builder, after-save Record-Triggered Flows) run
- Escalation rules (Case) run
- Entitlement rules run
- Roll-up summary fields recalculate on parent records
- Cross-object workflow on parents fires if applicable
- Criteria-based sharing recalculation runs
- DML commit — the transaction is finalised
- Post-commit logic runs: email send, async Apex (
@future, Queueable, Batch finishers), Lightning notifications
Why this matters for design
- Validation runs before triggers — so trigger-set fields don’t help validation pass
- Workflow runs after triggers — your trigger sees the user’s edits, but not workflow field updates
- Flows can run before triggers — before-save Record-Triggered Flows execute around the same time as before-triggers (since 2021)
- Roll-ups recalc last — your trigger reads the old roll-up value, not the post-save one
The classic interview trap
“What’s the order of execution?” gets asked at every level. A common follow-up: “If I update a field in a before trigger, and a workflow field update sets it to something else, which value wins?”
Answer: The workflow value wins, because workflow runs after before-triggers. But that workflow field update re-fires before/after triggers on the record, giving them a second chance.
Where after-save flows fit
Salesforce’s modern guidance is to use before-save Record-Triggered Flow for same-record updates instead of workflow field updates. Before-save flows run at roughly the same point as before-triggers (slightly before, in step 4ish) and don’t require an extra save like workflow field updates do — they’re orders of magnitude faster at scale.
What interviewers want
- The list in order, not necessarily verbatim but with the key stations: validation, before trigger, after trigger, workflow, flow, commit, async
- The detail that workflow field updates re-fire triggers
- Awareness of where before-save flows sit (essentially with before-triggers)
Verified against: Apex Developer Guide — Triggers and Order of Execution. Last reviewed 2026-05-17 for Spring ‘26 release.