Delete Paused Flow Interviews in Salesforce

Business Problem

This article will explain how to automate the deletion of paused flow interviews in Salesforce so your users can circumvent errors and ensure you will not hit the paused flow interview limit.

If you have experimented with paused flows, I am sure you have encountered one of the following issues:

  1. Cannot delete a record with a paused flow
  2. Cannot convert a Lead with a paused flow - receive error 'Unable to convert lead that is in use by workflow' - if you are experiencing this issue, check this article out too.
  3. Cannot activate a Contract with a paused flow

Another issue is you have a 50,000 limit on Paused Flow Interviews in your org. Currently, there is no way to identify which record a Paused Flow Interview record is for, unless you stamp the Flow GUID on the record that started the flow.

The solution is for the System Administrator to delete the paused flow interview from Setup or delete them in mass via data loader. This is not a desirable solution in all scenarios. Let me explain further ...

Let's say you have a process builder that invokes a flow which waits for 2 days to send a reminder email only if the Lead Owner has not updated the Lead Status = Contacted. Now let's say the Lead Owner updated the Status = Contacted after 1 day and then wants to convert the Lead. They won't be able to until the paused flow interview record has been deleted. The solution is to delete the Flow Interview record when the Lead Status is changed to Contacted. Great idea, so how do we do automate this?

We have created a free AppExchange package that contains the components you will need to delete Paused Flow Interviews on the Lead object. The package contains the following:

  • Lead Flow Id (Custom Field on Lead Object) - this field stores the Id of the paused flow interview record so we can find it to delete it.
  • Delete Paused Flow Interview Record (Autolauched Flow) - this flow can be reused for any object and can be used as a subflow or invoked by a process builder.

How It Works

We are starting with a Process Builder which invokes a flow when a new Lead is created. Here is what the process builder looks like:

The first step is to update the Lead Flow Id field in your flow that is creating the paused flow interview record. In our example, we added an Update Records element to our flow to update the Id on the Lead.

Here is what the flow will look like:

Next go to Flows and then find the Delete Paused Flow Interview Record flow you installed from the package. Click Activate

Now we are going to add a criteria action group to our process builder to delete the Flow Interview record whenever the Lead Status = Contacted. This will make sure we are cleaning up the paused flow interviews as we go and make sure we do not run into an error when converting the Lead.

Make sure to Activate the process builder and you are ready to test it out!

Now the cool part about this is you can reuse the Delete Paused Flow Interview Record flow you installed from the package for any object. You just need to create a custom field on the object to hold the Flow Id and make sure to pass the value from the Flow Id field to the varFlowId variable in the flow via process builder.

If you need instructions on how to convert a current process builder using scheduled actions to using a process builder with a flow, check this article out.

For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!

Share This Story, Choose Your Platform!

About the Author

Cheryl Fernandes

Cheryl is a certified Salesforce Application Architect and is the Founder and Lead Salesforce Consultant at Blu Ninjas. She has been working with Salesforce for 12 years and has helped companies in financial services, insurance and beauty industries implement solutions on the platform. Flow is her favorite Salesforce declarative tool, it is a game changer for anyone who does not know how to code.

3 thoughts on “Delete Paused Flow Interviews in Salesforce”

  1. Domenick Verga

    Hello,

    Thank you for this. I actually ran into a situation where I just happened upon a need for something like this. The only issue I am seeing is that in my case we are running drip email campaigns that have scheduled actions that queue up (i.e. one is sent upon insert, then another process builder queues another one up for 6 days later, etc). The criteria for stopping the drip email campaign is the lead converting into a person account in our case. So a status of Converted would stop the process builder from running, but since we have a queued time scheduled action, it will not allow us to convert in the first place.

    I feel like what you provide here is so close to what we are looking for, but I can’t quite wrap my brain around how to modify it for this use case versus something like the contacted in your example, which happens independently of the conversion.

    Any help would be grateful. Thank you for the awesome information either way.

    1. Hi Domenick,

      It sounds like you need to replace the scheduled actions with a flow that contains a Pause element just like in the post. So you would have a process builder with one criteria action group to invoke the flow to send the emails and then the 2nd criteria action group would invoke the Delete Flow Interview Record flow when the lead is converted. You are right it is very similar to the example. I was thinking that I could make a blog post on how to replace a Scheduled Action in process builder with a paused flow using your example. Can you provide me with more info on the criteria for your process? It sounds like it sends an email when the Lead is created and then another email after 6 days. But if the Lead is converted before the 6 days you need to allow the person to convert the lead and remove the email that was scheduled to be sent. Is this correct?

      If you prefer, you can also post your question in the Salesforce success community and we can exchange screenshots there. Just ping me here with the link to the question.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top