There are two ways to trigger flows based on a record change. You can trigger the flow to run just before the record is changed or just after the record has been changed.
Currently, if you want to trigger after the record has been changed, you create a Process Builder process and use it to launch your Flow. As of Summer 2020, you have an ability to trigger a flow upon record update without process builder. Theoretically, this could be the beginning of replacing Process Builder, but it still has some work to be done (changed values and the Isnew() function are two big highlights!). See the documentation here, and also a great blog post by MVP Jen Lee Here.
If you want to trigger before the record has been changed, you can do so directly from Flow, as of Spring ’20. The functionality documentation is here.
Considerations when using Before-Save Triggers
Normally, if you want to update a record, you use the Update Records element. But with a Flow that’s triggered by a Before-Save Trigger, the update will happen automatically and you should not try to add an Update Record element to it.
A before-save flow also runs up to 10 times faster than other record update measures (See the Salesforce documentation here.
Order of Executions
Before save triggers will fire before the PB ones (since PB is after save), so customers should generally avoid editing the same fields in both before-save and after-save triggers, as they might get weird results. Before-save will obviously always get applied first, but if a process fires off another save the before-save trigger could get executed again (and the process will again), so if they’re not careful they could cause nondeterministic loops (up until the PB recursion limit).
- Salesforce Flowsome on Before-Save Flows
- Before-Save Flows and Accidental Recursion
- Jen Lee on Before Delete Flows
- Jodie Miners on Before-Save Flows
- Spring 20 Before-Save Flows and Apex Triggers (Bob Buzzard)
- Using Before-Save Flow and Custom Metadata Type to Update a Region Field (Gidi Abramovich)
- Using Before-Save Flow to Prevent a Record Creation/Update based on its Sibling Records’ data (Gidi Abramovich)