0

A coworker had an assignment to rework workflows/process builders to flows. The fast field update flows (before triggered) all have the "Update Triggering Record" for all kind of changes and I'm worried this causes another update (re-running all validations, automations etc) and perform much slower instead of just using the "Assignment" element, that I know just alters the current DML.

So my question is really if there is any difference between the "Update Triggering Record" and "Assignment" element when doing same record updates in flow in terms of resources?

Also, what happens if there are multiple "Update Triggering Record" in one flow instead of multiple assignments? Will there be one update for each "update-element" or are they combined into one/no extra update?

2 Answers 2

3

Before Save Flows operate the same as before insert/update Apex triggers. They modify the record after standard validations but before the first save noted in Triggers and Order of Execution. Unlike the After Save triggers, they do not cause another round of validation/flow/trigger execution, and are therefore very efficient at updating the triggering record (very nearly as fast as a before insert/update Apex trigger).

You can, and should, use Before Save Flows whenever possible, as they do not trigger a recursive DML operation. Note that in a After Save flow, an Assignment is not sufficient to update the record. You must also use an Update Record element to actually save any changes, which is also what causes the second round of validations and triggers to execute. Using multiple Update Record elements will result in even further DML operations being executed, so we must take care to combine all such updates into a single Flow and a single Update Records element, if possible.

Note that flows are bulkified, in the sense that multiple records being processed at once will execute the flows essentially "in parallel", but only in the sense that each Update Records element will act as a blocker, and then be bulkified from there. If you have a conditional decision that ends up going to two different Update Records elements, either because another blocking element is on a decision path, or because you used different elements, multiple updates may be triggered. Always try to minimize the number of blocking paths to take full advantage of this feature.

2
  • Thank you for your detailed answer. Specifically in a "before save flow", is it ok to use the "Update Triggering Record" and also to use multiple "Update Triggering Record" instead of assignment then if Before Save Flows do not trigger recursive DML operations? I'm contemplating whether to rebuild all the before trigger flows to use only assignments instead of update elements.
    – Andegosu
    Aug 8, 2022 at 13:27
  • @Andegosu There is a limit to the number of elements a flow can execute, so you should minimize how many Update Triggering Record elements you use, but they don't otherwise use DML limits or cause recursive DML operations. I don't think it matters which you use here.
    – sfdcfox
    Aug 8, 2022 at 13:53
0

So my question is really if there is any difference between the "Update Triggering Record" and "Assignment" element when doing same record updates in flow in terms of resources?

There is very little difference. You can use either the Update element or the Assignment element. The key is that triggers and validations are NOT recursively kicked off in before-save Flows as they are in after-save Flows (as sfdcfox mentioned). This means the performance is almost the same whether you use the Update or the Assignment element.

This article is very helpful: https://metillium.com/2021/07/before-save-assignment-vs-update-records-performance-benchmark/

The change happened in the Summer '21 release: https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_record_triggered_flows_update_records.htm&type=5&release=232

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .