Flow Explorer – Order of Flows and Updates in Before Create

before-triggervisual-workflow

Hia there,
We are doing some code updates, we used to have all of our automations in a single flow, due to the fact, that there was no OOE that we could control.
With the new Flow explorer, we are now able to control, which flow first, so we are breaking our flows into smaller units. (lots of benefits with that).

One issue that I face:
In a before create flow of a record, there might get a record with no value, using a flow (which is set to run first) I update that field with the value I want.
I only use the assignment component:

enter image description here

As the flow ends 2nd flow starts:
enter image description here

However, the values from the first flow are not visible/saved.

Do I need to do an update record on the first flow ?
Create ?
Not quite sure of the logic here.

Any advise is appreciated.

Best Answer

Salesforce provides the same "before" and "after" view to every "before save" Flow and "before DML" Apex Triggers. This design is meant to provide the illusion that all of these logic units are running concurrently. As such, no flow or trigger will see any changes made by any other component during this phase. During the first commit phase in the Triggers and Order of Execution, the final values that were stored in $Record/Trigger.new will be saved to the database. Earlier updates to the same field will be overwritten by later values. The ordering, therefore, is important with respect to the fact that later updates will overwrite earlier updates. This same logic applies as well to the after save logic (e.g. after save flows, process builders, workflow field updates). What you'd need is to design the system using subflows, but, at the time of this answer, isn't available. You'll want to go vote on that idea. In the meantime, you need to either duplicate your efforts in each flow, or move to the slower after-save flow triggers so you can coordinate updates using subflows.

Related Topic