Convert Scheduled Actions to Paused Flows

Business Problem

This article will explain how to convert your process builder from using scheduled actions to using paused flows. Please review this blog post prior to reading this one, it will help further explain deleting paused flow interviews. You may have run into one of the following issues when using either time-based workflow or a process builder using scheduled actions:

  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'
  3. Cannot activate a Contract with a paused flow

Process Builder with Scheduled Actions

In this example, we have a process builder that sends two emails, one when the Lead is created and the other 6 days after the Lead is created.

If a user wants to convert the Lead prior to this date, they receive an error Unable to convert lead that is in use by workflow. The solution from Salesforce is to go to Setup | Paused Flow Interviews and delete the paused flow that is causing the issue. Good luck in finding which one it is if you have many to choose from! Our recommendation is to replace the scheduled actions with a paused flow.

How to Convert Scheduled Actions to Paused Flow Interviews

Here is a view of the entire process builder you will need to build in order to replace the scheduled actions with flows, so your users can convert Leads without getting an error. You will need one process builder, two flows and a custom text field on the Lead. This AppExchange package contains one of the flow and the custom field you will need.

Now let's break it down, step by step. We can see that when the Lead is created we are invoking a flow to send the emails instead of using the scheduled actions. Make sure to set the flow variable for the Lead Id.

Here is what the flow looks like that sends the two emails:

First, we update the Lead with the Flow Id, this is so we can find the Flow Interview Record if we need to delete it later. Here is a screenshot of the Update Records - Update Lead w/ Flow Id element:

Then, we send the first email to the Lead using an Email Alert. This action uses the same email alerts you are using in workflows.

Next, we use a Pause element to wait for 6 days after the Created Date to send the 2nd email. Set the element to wait for a specified time and to use a record field.

When six days passes, we lookup the Lead to make sure the Lead Status = Open with a decision element. If it is Open, then we send the email.

Last, we remove the Flow Id from Lead record so it does not cause an issue later.

In This Scenario

The Lead went through the entire flow and received both emails. But what if the user wants to convert the Lead before six days has passed? If you look at the process builder, there is a 2nd action group which is looking for the IsConverted = True and Lead Flow Id to have a value.

When this criteria are met, the process builder invokes the flow and passes the Lead Flow Id to the flow:

This flow looks for a Flow Interview Record that has a Flow GUID = Lead Flow Id. If it finds a match, it deletes the record. Here is an overview of the flow, this flow is part of this AppExchange package.

Next, the process builder removes the value from the Lead Flow Id field.

Any comments, questions, concerns – let us know in the comments! 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 Lead Salesforce Consultant at Blu Ninjas. She has been working with Salesforce for 10 years and has helped companies in financial services, insurance and beauty industries implement solutions on the platform. Process builder and flow are her favorite declarative tools, these tools are a game changer for anyone who does not know how to code.

10 thoughts on “Convert Scheduled Actions to Paused Flows”

  1. Hello, I have tried to implemented the things as per the post. In my Process builder “Lead Is Converted” condition is not working and due to that I am not able to delete flow Id. I have added lead.isconverted equal true and lead.flow id not null condition. Can you guide me is there any way so i can resolve it.

    1. Hi Vipul,

      I apologize for the delay in responding, we had a plugin that was blocking comments from our website and missed this! I can help, can you provide me with screenshots of what you currently have built and what the error looks like you are receiving?

  2. Hi Cheryl,
    I followed the instructions in the article but but it doesn’t work.
    When I try to convert a Lead, I continue to receive the same error: “Unable to convert lead that is in use by workflow.”.
    Activating the log before of conversion seems that the process and the flow don’t start at all. It looks like it is a validation rules, so it acts before process builder and flows: could you help me?

    1. Hi Serena,

      Thank you for your patience, we had an issue with our comments coming through. Can you share with me a screenshot of the error you are receiving? Is the error on the Lead, Contact, Account or Opp object?

    2. Hey Serena, I’m curious if you were ever able to figure this one out? My org is having the same exact issue.

  3. Hello Cheryl, Thanks for the post. I got the same issue due to Paused flow. I have create process builder as mentioned into the post for removing flow ID. but my lead is converted condition not getting true.

  4. Hi Cheryl,

    I set up everything as instructed (at least I think so), but I am still getting Error: Unable to convert enquiry that is in use by workflow.

    Any suggestions?

    Regards,
    Ivan

    1. Hi Ivan, It is impossible for me to help without more information. My only guess is that maybe the record you are testing with is an old record and it is not stamped with the Flow GUID. Check to make sure the record has a value in this field. If it doesn’t then you will have to manually delete the paused flow interview for this record in Setup.

    1. Hi Sarah,

      I am sure there is a way to do this without process builder. We are currently working on upgrading all of the packages in the How To’s section to only use flows. We will let you know when they are ready.

Leave a Reply

Your email address will not be published.

Scroll to top