Salesforce Order of Execution Visualized

Anup ☁ Jadhav
Salesforce Architects
4 min readAug 11, 2022

--

As a developer, administrator, or architect working on the Salesforce platform, you’ve most likely come across (and maybe even memorized) the triggers and order of execution page in the Apex Developer Guide. Understanding what happens under the hood when you insert, update, or upsert a record in Apex or a flow is critical due to the complex nature of how no-code, low-code, and pro-code implementations intersect and interact.

The new Architecture Basics document includes a visual overview of the order of execution that communicates the complex steps, operations, and decision elements involved in the process. This can be used as a helpful reference alongside the official developer docs. While the diagram notes the API version that it aligns to, the visual overview is not meant to replace the official documentation; always refer to the Apex docs when in doubt.

Why did we create a visual?

We noted both a demand for and the popularity of visual overviews for the order of execution flow. This was based on the frequency and number of community-created flowcharts that we stumbled upon in social media, the Trailblazer Community, and other channels. In response, we worked with product, documentation, and design teams to create this version of the visual using the Salesforce Diagramming Framework.

Architects tend to use flowcharts and other diagramming tools to explain and communicate their designs with the technical team or the business. Following the same principle, we created this flowchart to be used to quickly communicate the complexity of the order of execution in a way that highlights the relevant dependencies and brings important considerations to the fore.

How to use the diagram

The flowchart is designed to be self-explanatory, but if you are unsure how to read this visual overview (or if you are simply interested in some design choices we made), here are some useful pointers.

Let’s start with the legend, which contains information about border color treatment, icons used, and additional footnote information.

Legend from the Order of Execution Overview diagram.

Some key points to highlight are:

  1. The diagram aligns to a specific version of the Apex API since you can view different versions of the order of execution in the developer docs. We will keep this diagram updated to align with the latest version of the Apex API, but if you want to ensure the version of the visual you’re looking at is up to date, you can check it here.
  2. The icons on the left are used to identify the process type (workflow, trigger, flow, and so on) and also enable you to quickly identify the element under consideration in the diagram.
  3. The diagram uses different colors to highlight the various actions (or verbs). This treatment enables you visually categorize the action type when looking at the flow.
  4. The footnote icons on the right provide additional context to the process steps and are noted in the bottom right of the card when applicable.

Let’s take a closer look at one of the cards that represent the steps/process elements in the diagram.

Zoom in of the Executes Flow from the Order of Execution Overview diagram.
  • The border color indicates that this is an Execute block
  • The icon (top left) indicates that the element is describing a flow
  • The number 13 maps to step 13 in the official docs
  • The title describes the main action/process
  • The attribute list provides additional information to clarify the context
  • In this example, the element includes an icon in the bottom right. The associated footnote for this icon in the legend states that “When a process or flow executes a DML operation, the affected record goes through the save procedure”.

Conclusion

Our goal in creating this visual overview was to make it easier for developers, administrators, and architects to understand the order of execution and to communicate this with teams building solutions on the Customer 360 platform. Take a few moments to review it, and remember to keep it handy as needed for a reference.

--

--