Salesforce : Order of Execution

Salesforce : Order of Execution

Updated for 2022

Ranjit Singh's photo
Ranjit Singh
·Jun 17, 2022·

2 min read

With every new release Flows are getting more diverse and more robust system to handle changes in the salesforce Org. Listing the order of execution in salesforce including Flows after API-54 release.

1) Load original trigger.old

2) Load new values trigger.new

3) Standard System Validation

4) Execute Before save Flows

5) Execute all Before Triggers

6) System Validation and custom Validation Rules

7) Duplicate Rules (if duplicate check failed - does not save and exit)

8) Saves to DB - No Commit

9) Execute all After Triggers

10) Execute Assignment Rules (Leads & cases)

11) Execute Auto-Response Rules (Leads & cases)

12) Workflow/Approval rule evaluation (Run upto 5 more times) a) Immediate field updates b) Email Alerts, Create Task, Outbound messages c) Field updates? - If yes - i) Before Triggers ii) System validations iii) After Triggers

13) Execute Escalation Rules (Case)

14) Process Builder Evaluation (Run up to 5 more times) a) Process builder Actions b) Invocable Process builder c) Flow Launched by Process d) Field updates? - If yes - i) Before Triggers ii) System validations iii) After Triggers

15) Execute after Save Flows (API54+), Execute Entitlement Rules (CASE), Execute After Save Flows (API 53) & Earlier

16) Calculate Roll-up summary on parent record

17) Calculate Roll-up summary on grandparent record

18) Execute Criteria based sharing. All changes to sharing table are calculated

19) Commit All DML to Database

20) Post commit logic - (Send email, outbound message, Time based workflow actions, Async Apex, Future methods, Calculated Index (Search))

21) Approval & Workflow Time based field updates (API 54+) a) Before Flows b) After Flows

order-of-execution.webp

 
Share this