Skip to content
LinkedIn

Flow Optimisation Strategy

Just had an insightful moment reflecting on a technical interview question: "How do you optimize flows for an object with 15 existing flows?" Initially, I responded by discussing the option of managing the order of execution in flows. However, upon reflection, I realized there are more nuanced approaches to consider for maximizing efficiency within Salesforce.

Leveraging Specific Entry Criteria

One strategy involves creating smaller flows with specific entry criteria. This approach helps to limit the number of records being triggered and can significantly enhance performance. With the recent Spring '22 release, Salesforce introduced the ability to set the order of execution for all record-triggered flows, providing greater control over flow execution.

With the Trigger option, simply assign a number from 1 to 2,000 to prioritize the sequence in which your flow triggers run for a specified object. But here's the game-changer - when assigning values, evenly distribute them. For instance, opt for values like 10, 20, 30 instead of 1, 2, 3. Therefore, in the future if you have to insert another flow between existing ones, you won't have to tweak the trigger order values of all the flows. Just set the trigger order of the new flow as, let's say, 16, and you're good to go.

To get to the trigger option, simply click on Show Advanced when you are saving the flow.

Show advanced on save

Save options

Find out more about the guidelines here.

Per Object, Per Type Flows

Another effective approach is to create flows for each object and type. By segmenting flows in this manner, it becomes easier to manage the complexity of flow logic. Utilizing subflows can further streamline the process and prevent flows from becoming overly bulky. For instance, flows can be structured to execute actions before and after record creation, update, or deletion.

Flow Trigger options

You can also combine create and update operations within the same flow and differentiate them using decision elements such as isNew() and isChanged() or you can also keep them separate.

While both approaches have their merits, I personally find working with smaller flows, each with specific entry criteria, to be far more manageable and efficient. Why? Because navigating through numerous subflows within a single large flow can be a bit of a headache, especially when it comes to debugging.

Fortunately, with the trigger order of execution now available, controlling the flow of execution has become much smoother sailing. This functionality offers a level of granularity that allows for more precise execution of processes. And the best part? It makes it incredibly easy to divide complex logic into smaller, more manageable flows.