Pause Element

 




Pause Element




Flows that contain Pause elements must be autolaunched.

If a flow includes Pause elements and screens, choice, or choice sets, you can’t activate or run it.

What are Interviews?

An interview is the execution of a flow.

If you have multiple users running a flow, each time a user runs the flow a new interview commences.

A single user will have multiple interviews if they run the flow multiple times.

When a flow ends (without going into a pause), the interview is completed and removed.

We can view paused interviews here:



Considerations for using Pauses

  • After you deactivate a flow version, its paused interviews continue to wait for the configured resume events. You can’t delete a flow version if it has paused interviews.
  • An interview can execute only one connector per Pause element. After one of its resume events is processed, the remaining resume events are removed from the queue.
  • An org can have up to 50,000 paused interviews.
  • If the user who started the interview is deactivated when Salesforce tries to execute a pause connector, the interview fails to resume.

There is more information about pausing flows here: Paused Flow Interview Considerations

Sample Flow using Pause


For this example, we have added another option to our master flow with subflows to run the pause flow:




The new subflow has a Pause element and then an Action to Post to Chatter:




The Pause element has two parts. First, the Pause Conditions and secondly the Resume Event to cause the pause to end:




The Resume Event (1 Hour after the current date/time when the pause started):



The Action that will occur after the pause is completed it to post a message to Chatter on the record that started the flow:


When we then run the flow in debug mode and select the Pause subflow, it goes into pause mode for an hour:


If we view the Paused Flow Interviews from Setup, we can see our paused flow interview:



Finally, after 1 hour, we can see our paused flow has completed and posted the message to Chatter:



Exercise: Create a Pause in a Flow


Pause Elements


Flows that contain Pause elements must be autolaunched.

If a flow includes Pause elements and screens, choice, or choice sets, you can’t activate or run it.

Creating a Flow using Pause


For this example, you will add another option to your flow with subflows (created earlier) to run the pause flow:




The new subflow has a Pause element and then an Action to Post to Chatter:




The Pause element has two parts. First, the Pause Conditions and secondly the Resume Event to cause the pause to end:


Create a new Flow of type Autolaunched Flow (not a Screen flow this time):




Give the Pause Condition a name:




Next, configure the Resume Event for 1 Hour after the current date/time when the pause started:




The Action that will occur after the pause is completed is to post a message to Chatter on the record that started the flow.

Add a new Action element:



Configure the action as follows:




Add recordID variable to the pause subflow

Add a new variable named "recordId" of type text and make it available for Input.

This will be received from the main flow and will contain the ID of the contact record.

Save the flow as PauseFlow.



Update the main flow

Go back to the main flow that calls the subflows.

Add a new variable named "recordId" of type text and make it available for Input and Output. (this will be received from the page calling the flow and will also be passed to the pause subflow).

Edit both the screen and the decision elements to include the new pause subflow.

When this is done, add the new subflow. Refer to pic #1 for the location.

Make sure you select to pass the recordId into the new subflow.

Save the updated main flow.



When you then run the main flow in debug mode and select the Pause subflow, it goes into pause mode for an hour:


If you view the Paused Flow Interviews from Setup, you can see your paused flow interview:



Finally, after 1 hour, you can see your paused flow has completed and posted the message to Chatter:




Paused Flows, tick! smile

No comments: