Last Updated on November 23, 2020 by Rakesh Gupta
Big Idea or Enduring Question:
In this article Getting Started with Process Builder – Part 2 (Time-dependent actions), I had discussed how to add a Time-based action into a Process. I also discussed a way to check the Paused and Waiting 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 an Interview (An interview is a running instance of a Flow) from the Paused and Waiting Interviews queue, but it doesn’t allow you to mass delete/remove the Paused and Waiting Interview. In this article, we are going to discuss a way to mass delete/remove Waiting and Paused Interviews.
This blog post will help us to understand the following
- How to mass delete/remove Waiting and Paused Interviews.
- Setup a simple Flow
Business Use case
Martin Jones is working as a System administrator at Universal Containers (UC). He developed a Process to update the Account Description after 5 days of its creation. For testing purposes, he created 10 records, which means 10 Jobs/Interviews are waiting in Paused and Waiting Interviews queue. He wants to delete all the Interviews from a Single click instead of deleting 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, Lightning 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 Waiting Interviews. Let’s begin building this automation process.
Guided Practice (We-do):
There are 2 steps to solve Martin’s business requirement using Lightning Flow. We must:
- Define flow properties
- Add a delete records element
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows, then click New Flows.
- Select the Screen Flow option and click on Next and it will open the flow designer for you.
Step 2: Add a 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: Interview Label
- Operator: Equals
- Value: Sample_Process-1_InterviewLabel
- Row 1:
- Click Done.
The question arises here why we have chosen InterviewLabel in the Preceding screenshot, why not any other fields.
- This is because there are a limited number of fields that you can select in the Record Delete element for FlowInterview.
- InterviewLabel field is made up of ProcessAPIName-VersionNo_ObjectName and API Name is always the same for all versions of a Process
- It also gives you the flexibility to mass delete Interviews of a specific version of a Process
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 Paused and Waiting Interviews as shown in the following screenshot:
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
Currently, there are 4 Interviews waiting in Paused and Waiting Interviews queue for Process Sample_Process-1, as shown in the following screenshot:
It’s time to Run the Flow to mass delete Interview those belongs to Process Sample_Process-1. To do this navigate to Setup | Flows and click on the Flow Mass delete Paused and Waiting Interviews, it will redirect you to the Flow detail page. Now click on the Run button, shown in the following screenshot:
Go back to Paused and Waiting 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.