Last Updated on February 10, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
In this article Scheduled actions, I had discussed how to add a Time-based action into a Process.
I also discussed a way to check the Paused and Failed Interviews in the Flow and Process Builder, by navigating to Setup | Paused Flow Interviews as shown in the following screenshot:
Use the Del link to remove a Flow Interview (An interview is a running instance of a Flow) from the Paused and Failed Interviews queue, but it doesn’t allow you to mass delete/remove the Paused and Failed Flow Interviews.
In this article, we are going to discuss a way to mass delete/remove Waiting and Failed Flow Interviews.
This blog post will help us to understand the following
- How to mass delete/remove Waiting and Failed Flow Interviews.
- Setup a simple Flow
Business Use case
Martin Jones is working as a System Administrator at Gurukul on Cloud (GoC). He developed a Flow to update the Lead Rating after 5 hours of its creation. For testing purposes, he created 3 records, which means 3 Jobs/Interviews are waiting in Paused and Failed Flow Interviews queue. He wants to delete all the Interviews with a Single click instead of deleting them one by one.
Below is the screenshot of the most active version of a Process.
Automation Champion Approach (I-do):
While this can be solved using various automation tools like Apex or Flow. In this case, Salesforce Flow is being used to solve this requirement.
Before proceeding you have to understand the below-mentioned objects in Salesforce:
- FlowInterview: -This object represents a flow interview. An interview is a running instance of a Flow.
This article will help you understand how to mass delete Paused and Failed Flow Interviews. Let’s begin building this automation process.
Guided Practice (We-do):
There are 2 steps to solve Martin’s business requirement using Salesforce Flow. We must:
- Define flow properties
- Add a delete records element to delete flow interviews
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Screen Flow option, and click on Create and it will open the flow designer for you.
Step 2: Add a Delete Records Element to Delete Flow Interviews
- On Flow Designer, click on the + icon and select the Delete Records element.
- Drag-and-drop Delete Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- For How to Find Records to Delete select Specify conditions.
- Select the Flow Interview object from the dropdown list.
- Set Filter Conditions
- Row 1:
- Field: InterviewLabel
- Operator: Contains
- Value: Lead Capture Form
- Row 1:
- Click Done.
- This is because there are a limited number of fields that you can select in the Record Delete element for FlowInterview.
- It also gives you the flexibility to mass delete Interviews of a specific version of a Flow.
- It also gives you the option to choose another field like Flow Version
- More improtant, you can able to customize Flow label as per your need.
In the end, Martin’s Flow will look like the following screenshot:
Click on the Save button and save the Flow with the name Mass Delete Flow Interviews as shown in the following screenshot:
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
Currently, there are 3 Interviews waiting in Paused Flow Interviews queue for Flow Lead_Capture_Form version(1), as shown in the following screenshot:
Go back to Paused Flow Interviews section available on the Flow Management page and check it out:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world?
Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.