Flow / Admins

Salesforce Flow Pause Element: The Best Flow Feature You Haven’t Heard of Yet

By Tim Combridge

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). 

READ MORE: What I Wish I Knew About Record-Triggered Flow

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:

  • AIPredictionEvent
  • BatchApexErrorEvent
  • FlowExecutionErrorEvent
  • FOStatusChangedEvent
  • OrderSummaryCreatedEvent
  • OrderSumStatusChangedEvent
  • PlatformStatusAlertEvent
READ MORE: Salesforce Platform Events: Explained

Summary

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.

The Author

Tim Combridge

Tim is the Managing Director at Sensible Giraffe, passionately educating others via high-quality blog content and training courses including the Ultimate Salesforce Flow Foundation Course.

Comments:

    S. Rugg
    June 12, 2023 4:46 pm
    Another valuable feature of Pauses is that like a Screen component in a screen flow (where Pause cannot be used) they force commitment of data transactions to the database so that the updated record is available to the flow after the Pause.

Leave a Reply