Update New and Changed Records 10 Times Faster by Using Before-Save Updates in Flows
Where: This change applies to Lightning Experience and Salesforce Classic in Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.
Who: To activate a flow that makes before-save updates, you need the View All Data permission.
Why: Perhaps you’re familiar with Process Builder and using a record-change process to make additional updates to each record that triggers the process. Such a process can set the Region custom field automatically on each new case record. Before-save updates in flows accomplish that same goal, but much more quickly because each record doesn’t get saved to the database again. Avoiding that extra save procedure means skipping another round of assignment rules, auto-response rules, workflow rules, and other customizations that take time to execute.
Perhaps you’re familiar with Apex triggers. A flow that makes before-save updates is similar to a before trigger. The previously described record-change process is similar to an after trigger. In a save procedure, before-save updates in flows are executed immediately prior to Apex before triggers.
- Access field values that are set only after the record is saved, such as the Last Modified Date field or the ID of the new record.
- Create or update related records.
- Perform actions other than updating the record that launches the flow.
How: Create an autolaunched flow and open the Start element. For What Launches the Flow, select New or updated records—flow makes fast field updates.
For a flow that makes before-save updates, the Flow Builder toolbox offers only four elements: Assignment, Decision, Get Records, and Loop.
In the flow, the $Record global variable contains the record values. Use an Assignment element to update those values, and let Salesforce handle the rest. You don’t even have to create any variables or add an Update Records element to your flow.