function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikhil Tripathi 13Nikhil Tripathi 13 

Order of Executions1

Hi Team,

Can anyone help me with order of execution in salesforce ?
I have a trigger before insert and a flow which is recored triggered flow before creation  and validation rules , which will execute first while saving records 
VinayVinay (Salesforce Developers) 
Hi Nikhil,

Below is are the order of execution events.
  • Loads Initial record.
  • If the request came from a standard UI edit page, Salesforce runs system validation to check the record for page layout specific rules, field definition, Maximum field length.
  • Executes  flows that make before-save update. (New Change in Winter 20)
  • Executes all before triggers. 
  • Runs most Custom validation.
  • Executes duplicate rules. 
  • Saves the record to the database, but doesn’t commit yet. 
  • Executes all after triggers. 
  • Assignment rules. 
  • Executes auto-response rules. 
  • Executes workflow rules. 
  • If there are workflow field updates, updates the record again.
  • Due to Workflow field updates introduced new duplicate field values, executes duplicate rules again. If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
  • Executes processes and flow. 
  • Escalation rules. 
  • Executes entitlement rules. 
  • Executes record-triggered flows that are configured to run after the record is saved.
  • If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure. 
  • If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure. 
  • Executes Criteria Based Sharing evaluation. 
  • Commits all DML operations to the database. 
  • Executes all after-commit logic, such as sending email.
  •  
https://www.theblueflamelabs.com/order-of-execution-in-salesforce/
https://prasannajyothi.medium.com/what-is-the-order-of-execution-in-salesforce-c273f9059f6c

Please mark as Best Answer if above information was helpful.

Thanks,