What is the Order of Execution in Salesforce?

Safalta Expert Published by: Aryan Rana Updated Sat, 24 Sep 2022 12:16 AM IST


Salesforce's "Order of Execution" is a set of rules that control or explain how a record moves through various workflows and events from SAVE to COMMIT. Simply put, Salesforce carries out specific actions in a systematic manner when you save a record by using the insert, update, or upsert statement.

Table of Content


1. What is the Order of Execution in Salesforce?
2. Execution Order in Salesforce
3. Salesforce triggers
4. What Operations Invoke Triggers But Others Don't?
5. Additional Information
6. Conclusion

Salesforce transformed how businesses' marketing and sales teams previously operated. You should be aware of the chronological order in which processes are carried out if you're a Salesforce consultant or developer. We will talk about Salesforce, the purpose of Order of Execution in Salesforce, and its advantages in this article. By the end of 2021, Gartner projects that revenue in the Enterprise Software segment will exceed US$230 million. To keep up with the current technological era, businesses are turning more and more to technical CRMs. There are several rules in Salesforce that may be applied to objects and fields. Salesforce allows you to define various rules, such as validation rules, escalation rules, auto-response rules, triggers, and workflow rules. Knowing the sequence in which the rules and triggers are executed is crucial if you work as a Salesforce consultant, developer, or architect.  If you are interested in Digital Marketing or Graphic Designing and want to learn these interesting courses then click on the links mentioned Digital Marketing Course and Graphic Designing course

Download these FREE Ebooks:
1. Introduction to Digital Marketing

Free Demo Classes

Register here for Free Demo Classes

Please fill the name
Please enter only 10 digit mobile number
Please select course
Please fill the email
Website Planning and Creation

What is the Order of Execution in Salesforce?

In Salesforce, the term "Order of Execution" refers to a set of rules that control or explain how a record moves through various workflows and events from SAVE to COMMIT. Simply put, Salesforce carries out specific actions in a systematic manner when you save a record by using the insert, update, or upsert statement. In Salesforce, this is known as the order of execution. The DML action comes first in the execution order, followed by other involvements such as triggers, pre-built Salesforce components, workflows, various rules, etc.

Execution Order in Salesforce

1. Load the record needed for the upsert statement after loading the original record from the database.
2. Replace the previous values in the record fields by loading the new values from the request.
    If the request originates from a regular UI edit page, Salesforce does system validation to look for the following in the record:
  • Adherence to layout-specific regulations
  • Values that are necessary at the layout and field definition levels
  • Acceptable field formats
  • Longest field possible
3. Salesforce only validates the foreign keys when a request comes from another source, such as an Apex application or a SOAP API call.
4. Carries out record-triggered flows that have been set up to run ahead of record saving.
5. Does everything before trigger?
6. Run the majority of system validation steps. Run user-defined validation rules and make sure that all necessary fields have a value that is not null.
7. Carries out duplicate rules.
8. Records are saved to the database but not yet committed.
9. Carries out all after triggers.
10. Carries out assignment rules.
11. Put auto-response rules into action.
12. Performs workflow operations.
13. Implements escalation policies.
14. Refresh the record if any workflow field updates exist.
15. Fires before update triggers and after update trigger one more time (and only once more), in addition to standard validations, if the record was updated using workflow field updates.
16. Executes workflow actions and processes that have been started using flow triggers.
17. Applies entitlement regulations.
18. Applies entitlement regulations.
19. Carries out record-triggered flows that have been set up to run after the record has been saved.
20. Make calculations and update the roll-up summary field in the parent record if the record has a roll-up summary field or is a part of a Cross-object process. The saving process is performed on the parent record.
21. Performs computations and changes the roll-up summary field in the grandparent record if the parent record is updated and the Grandparent record has a roll-up summary field or is included in a cross-object workflow.
22. Carries out evaluation via criteria-based sharing.
23. All DML actions are committed to the database.
24. Carries out post-commit logic, such as emailing a user.

Following Commit Logic?

  • Every email is sent.
  • Apex for asynchronous processes: @future Outgoing communications are queued in async sharing rules
  • computes the index
  • creates file previews
  • Platform Events are published if they are set up.

Salesforce triggers

According to Salesforce, there are two different sorts of triggers:

Triggers that are triggered before record values are saved to the database are known as "before triggers."
Records that are read-only are triggered using after triggers.

You can add customised changes to the Salesforce record either before or after making changes. Triggers allow for this. Apex can be triggered. Triggers are carried out either before or following certain actions:


Triggers are supported by a few top-level objects, including Account. For these, you can specify triggers. You can go to that specific object's Object Management Settings and select Triggers if you want to define a trigger.

What Operations Invoke Triggers But Others Don't?

  • Records that did not initiate a delete do not set off triggers.
  • Using the merge procedure, reparented child records
  • significant email activity, division changes, and address revisions
  • changing the data in a custom field
  • When a picklist is renamed or changed
  • The transfer division option is checked when you alter a user's default division.
  • Price book control
  • Before or after a user's account is converted to a business account, the update account trigger won't function.
  • Update triggers won't function on FeedItem when the LikeCount counter rises.

Additional Information

The execution of a trigger is not certain when there are many triggers for the same object resulting from the same event. In this situation, Trigger Framework must be used.



What is the order of execution?

A collection of guidelines outlining the steps taken by a record during all automation and the events that take place between SAVE and COMMIT. If the record has any dependent pick-list fields, the browser does JavaScript validation before Salesforce executes these events on the server.

What do orders in Salesforce mean?

An order is a contract between a business and a customer to provide services or deliver goods with a known quantity, price, and delivery date. Whether you add orders to contracts or accounts depends on your Salesforce administrator.

What is Process Execution?

The execution of a process or an operation is referred to as process execution. A process can be a computation script, a workflow specification, a service, etc. A decision, a judgement, and other things can all be considered actions. An actor ought to be connected to process execution.

Free E Books