Mass Delete Paused and Failed Flow Interviews

Mass Delete Paused and Failed Flow Interviews

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.

Objectives:

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: 

  1. Define flow properties
  2. Add a delete records element to delete flow interviews 

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. 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 

  1. On Flow Designer, click on the + icon and select the Delete Records element.
  2. Drag-and-drop Delete Records element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. For How to Find Records to Delete select Specify conditions.
  5. Select the Flow Interview object from the dropdown list.
  6. Set Filter Conditions
    1. Row 1:
      1. Field: InterviewLabel 
      2. Operator: Contains
      3. Value: Lead Capture Form 
  7. Click Done.


The question arises here why we have chosen Flow Label 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.
  • 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:

It’s time to Run the Flow to mass delete the Interview that belongs to Process Lead_Capture_Form version (1). To do, click on the Run button available on the Screen Flow. 

 Go back to Paused Flow Interviews section available on the Flow Management page and check it out:


Formative Assessment:

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.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

 

5 thoughts on “Mass Delete Paused and Failed Flow Interviews

  1. It’s an old post and i really like this, as there is no other way for an admin to delete flow interviews. But i do have a question. If applying this to a great amount of failed flow interviews, Salesforce gives a CPU time out :

    Error element xxx (FlowScreen).
    Apex CPU time limit exceeded.

    Can this be solved in the flow?

  2. This is great, however, I have flow interviews that lack an interview label, so using Interviewlabel as the criteria in step two won’t work. I tried using Name = [api name of the process], but still received an error message that there wasn’t a flow that matched the criteria. Any ideas?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.