There are some things that all Salesforce Flow enthusiasts do on a daily basis. We know our way around Flow Builder quite well, and we pride ourselves on our knowledge of the tool – however, there’s always more to learn.
If you’re anything like me, you rarely come across or implement a Pause element in a flow. In fact, you may find yourself questioning your knowledge of Pause elements in general! So, today we will do a deep dive into what a Pause element is, and some important things to note about Pause elements in Salesforce Flow. We’ll also spend a bit of time learning about what a flow interview actually is, and how batches are used to process resumed flows in one hit. Let’s get into it!
What Is a Flow Interview?
Let’s start with some Flow basics that we need to address to better understand where and why we may need Pauses in our flows. A flow interview is an instance of your flow that is created when it is fired. It is essentially made up of two parts: the current context, and the logic within the flow. Salesforce explains that it is similar to the difference between an object and a record: the object is the structure that has been configured, and a record is an instance of that object (ie., Burlington Textiles is an instance of the account object).
If you want to take a look at the number of interviews (instances of a flow) that have run in your org in the last 30 days, you can do so from the Automation Home page in Setup. This is still in beta as of now (including the Summer ‘23 preview), and must be enabled in Setup.
Let’s say you’ve created a screen flow called ‘New User Onboarding’. This flow fires as a login flow every time a user logs into Salesforce to check if their onboarding procedure has been completed. That means that every time a user logs into your org and the login flow is called, a new flow interview is created for the flow at each login.
Another example would be if you have created a record-triggered flow called ‘Won Opportunity Procedure’ that executes a set of actions when an opportunity is set to closed won. Every time a new opportunity record meets the entry criteria and the flow is run, a new flow interview is created.
Properties of a Pause Element
It’s first worth noting that Pauses can only be used in autolaunched flows and scheduled flows. Flows with screens, choices, or choice sets in them will also not be able to be activated or run.
A Pause element is similar to a Decision element in that it has multiple paths, known as ‘Pause Configurations’, that are used to define different scenarios that the Pause needs to occur within and how the flow interview will be broken free from the Pause.
Each Pause Configuration has optional conditions to determine if the flow should Pause or not, and will also have a defined set of criteria that need to be met before the flow is resumed. If you add a Pause element to your Flow Canvas you will see it is broken down into two tabs: Pause Condition and Resume Event – his is where you’ll be able to configure those criteria.
While the Pause Conditions are optional, the Resume Event is mandatory as it determines how your interview will break free from the Pause. In the example above, there are two Pause Configurations, and as such there must be two different Resume Events configured. The Seven Day Pause Resume Event definition is below and shows that the flow interview will Resume after 7 Days (Base Time = OriginDateTime which is when the Flow originally launched, Offset is 7 which means 7 units after the Base Time, and Offset Units is Days which means that the Offset Number unit is Days, not Hours).
Paused Flow Considerations
While having the ability to Pause your flows is powerful, it also comes with some important considerations that you should keep in mind when designing and building your flows with Pause elements.
Firstly, as mentioned above, there are only certain flow types that support the ability to use Pauses. Autolaunched flows and scheduled flows are the only flows that support Pause elements, and if an unsupported flow type calls a subflow (autolaunched flow) it must not contain a Pause element. The below error was displayed when I tried to call a subflow with a Pause element from a record-triggered flow (remember, record-triggered flows don’t support Pauses).
Keep in mind that your org can only have up to 50,000 paused flow interviews at any one time. As powerful as Pauses are, you should use them intelligently as a result of this limitation. There may be a better way of managing time delays or criteria delays – consider schedule-triggered or record-triggered flows instead.
Interviews aren’t resumed in real time, nor are they resumed one-by-one. When a flow interview meets the criteria to be resumed, it creates a batch and is added to it. Any other flow interviews that are resumed during this time are also added to a batch. Exactly one hour after the first flow interview is added to the batch, the batch will be executed together in bulk in a single transaction.
Flows subscribe to Platform Events and can use them to resume a flow interview, however, only specific Platform Event types are supported. When planning your flow, make sure you only plan to use the following Platform Event types:
There you have it! In this article, we looked at why you might need to use a Pause element in a Salesforce Flow. We also went through step-by-step instructions for adding a Pause element to your flow and confirming each part of the Pause element is populated correctly. We also talked about some key considerations you need to remember when designing and building Pauses into your flows. Overall, using a Pause element can help ensure your flow runs smoothly and efficiently by allowing for necessary delays in a structured manner.