Using Flow to Convert Leads in Salesforce

Using Flow to Convert Leads in Salesforce

In Salesforce, leads represent potential customers, whether individuals or organizational representatives expressing interest in your product or service. The lead conversion process within Salesforce transforms these leads into accounts, contacts, and opportunities. Users can convert leads in Salesforce by changing their status to a converted status or clicking the out of the box Convert button. However, in some situations, you may want to automate the process and convert leads automatically. Although there is no standard action to convert leads, you can use custom apex actions.

In this post, you can find an invocable action that you can use to convert leads in flow.

How to Use the Component

1- Install the action using the installation links below.

2- Add a new action to your flow and search for "Convert Lead". This is the name of the action that you installed.

Convert Lead Action

3- This action has multiple input variables.

  • Converted Status: Converted Lead Status picklist value.
  • Lead ID: ID of the Lead that you want to convert.
  • Account ID: ID of the Account to convert Lead into. Leave it blank to create a new Account.
  • Contact ID: ID of the Contact to convert Lead into. Leave it blank to create a new Contact.
  • Create Opportunity: Default value is true. Set it as false if you don't want to create an Opportunity.
  • Opportunity Name: If you want to create an Opportunity, then this will be its name. If you leave it blank, then it defaults to Company field from the Lead.
  • Overwrite Lead Source: Overwrite the LeadSource field on the target Contact with the LeadSource field from the Lead. Default is false. If you set it as true, then you must also specify Contact ID.
  • Owner ID: ID of the user to own the new Account, Contact, and Opportunity records. Default is the Lead owner.
  • Send Email to Owner: Send an email to owner specified in Owner ID. Default is false.
Input Values of the Action

4- This action stores the Account ID, Contact ID, Lead ID, and Opportunity ID as the output. So that you can use them in the next elements of your flow.

Output Values of the Action
Using Flow to Convert Leads

Installation Links

Use this link to install in production or developer edition environments.

Use this link to install in sandbox environments.

6 Comments

    • Probably you add an ID, like accounID, that isn't populated on some iteration. I think "leave it blank if you don't want to create an account" applies only for the component field itself and not if variable is null.

    • Did you ever resolved this issue? I'm getting this error both when I leave it blank or when I get an empty value through formula.

  1. Why, in 2024, is it still necessary to call Apex in order to convert a Lead automatically? Every resource I could find recommends a combo of Apex + Flow, but none of them provide a reason as to WHY Apex is needed. When you convert a Lead, you create a Contact, create an Account for that Contact, and *optional* create an Opportunity. Let's say for our scenario all we want to do is IF Lead 'Status' = 'Hot', THEN 1) convert the Lead 'Status' = 'Closed - Converted' 2) Create a Contact for the Lead 3) Create an Account for the Lead, how is that not possible with an after-save record triggered flow OR screen flow?

  2. Hello, when trying to use this action I get this error message:

    An Apex error occurred: System.DmlException: ConvertLead failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, There was an error converting the lead. Please try again. If the problem persists, please contact your administrator.: []

    I tried with setting only Lead ID and Lead status as input values.
    Any ideas ?

Leave a Reply

Your email address will not be published.


*