What is the Order of Execution in Salesforce ?

708    Asked by AmeliaArnold in Salesforce , Asked on Mar 1, 2020
Answered by Amelia Arnold

The save order of execution is a sequence of events that occur when a record is saved in salesforce. All the events need to be executed successfully before the data is committed to the database.

Please find Order of Execution provided by Salesforce:-

On the Server Salesforce:-

 Loads the original record from the database or initializes the record for an upsert statement.

Loads the new record field values from the request and overwrites the old values.

 Executes all before triggers.

Runs most system validation steps again, such as verifying that all required fields have a non-null value,

          and runs any user-defined validation rules. The only system validation that Salesforce doesn't run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.

Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action,

         the record is not saved and no further steps, such as after triggers and workflow rules, are taken.

Saves the record to the database, but doesn't commit yet.

Executes all after triggers.

 Executes assignment rules.

Executes auto-response rules.

Executes workflow rules.

If there are workflow field updates, update the record 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,

         duplicate rules, and escalation rules are not run again.



Your Answer

Interviews

Parent Categories