Trigger a Flow to Run After a Record Is Saved

Creating or updating a record can now trigger a richer flow to run after that record is saved to the database. Previously, a record-triggered flow could only run before the record was saved, and the flow could only make updates to that new or updated record. After-save record-triggered flows can access other records, perform actions, and use more types of flow elements. These flows can even replace most workflow rules and record-change processes that are built in Process Builder.

Where: This change applies to Lightning Experience and Salesforce Classic in Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.

Who: To activate a record-triggered flow that runs after the record is saved, you need the View All Data permission.

Why: Perhaps you’re familiar with Process Builder and using a record-change process to execute actions, such as sending email every time a new account is created. An after-save record-triggered flow can accomplish that same goal, but with these added benefits.
  • You can choose to trigger the flow to run only when records are updated. This option isn’t available for record-change processes.
  • Unlike processes built in Process Builder, flows have a standard list view, so you can organize and adjust your view to your liking.
  • You can access other objects’ records and execute loops.

If you’re familiar with Apex triggers, an after-save record-triggered flow is similar to an Apex after trigger. In a save procedure, after-save record-triggered flows are executed after entitlement rules and before roll-up summary field updates.

How: When creating a flow, select Record-Triggered Flow.New Flow window, with Record-Trigger Flow selected

By default, new record-triggered flows are configured to run when a record is created and after the record is saved. You can check this configuration on the Start element in the canvas. Also from the Start element, choose the object whose records trigger the flow to run.Flow Builder, showing the Start element for a record-triggered flow. The Start element says, “Trigger: A record is created” and “Run Flow: After the record is saved”.

To trigger the flow to run when a record is updated, click Edit on the Start element.Configure Trigger modal, showing the three options for when to trigger the flow: a record is created, a record is updated, or a record is created or updated

In an after-save record-triggered flow, the $Record global variable contains the Salesforce record that launches the flow. You can update that record by using an Assignment element to set the fields on the $Record global variable. However, unlike before-save record-triggered flows, an Update Records element is required to save those changes to the database.

Configure the Update Records element to use the ID and all field values from the $Record global variable. But be sure to enable Filter inaccessible fields from flow requests in your org’s process automation settings. Otherwise, the flow fails because the Update Records element tries to set the values for system fields and other read-only fields.