Converting a Lead in Flow

Hate the lead conversion screen? Make your own in Flow with an Apex Plug-In.


  • Lead Conversion Apex Plug-In: Get Here
  • Screen Elements in Flow
  • Visualforce page
  • Custom Button

Why We Want a Custom Process: The User Story

Susie Q. wants to convert a lead and associate it with an existing opportunity (and therefore account). We do not want a new contact.


  • Install the plug-in.
  • I built a screen which asks the user to paste in the ID of the Opportunity with which they want to associate the lead. (Yeah, totally inelegant).
  • Do a Record Lookup of Opportunity to get the Account ID and assign it to the variable “OppAccountID.”
  • Drag the ConvertLead plug-in onto my screen from the palette.
    • Fill in the Input/Output options. See images below.
      • Side note, I could not find helpful resources for this online!
      • CreateOpportunity is a boolean which you tell it if you want a new opp or not.
      • For the Account ID, I tell it my variable OppAccountId, because I want to merge my lead into that Account.
      • For outputs, I assign ContactID to a variable. Unfortunately, there isn’t a boolean to tell it I don’t want a contact.
      • There are other options for input/output which I didn’t explore.
  • Add a Record Delete element to the screen to delete that Contact.
  • Create a custom button on the lead that launches the flow through a Visualforce page. Pass the lead id to the flow through the Visualforce page.



A Note on State and Country Picklists

The flow breaks if the existing account already has an “Other address.” The country has to be chosen before you can choose a state when using state and country picklists, and something in the apex plug-in does not like this. (It took me way too long to figure out that this was the problem – so I hope I save at least one other person this headache).

My work around?

  • In the flow, do a record lookup of the existing account after you get its ID from the lookup to the Opportunity
  • Store the values of the Other state and O country as variables
  • Do a record update to set the values of the state and country to an empty string in the account
  • Run the lead convert
  • Put the state and country back on the account

Published by


Jessie joined in 2018 to give introductory webinars to nonprofit customers. She now is a Senior Solution Developer supporting nonprofits and education customers at Salesforce. All opinions expressed on this blog are her own or those of the contributors. She's spent 17 years more or less in CRMs and databases, but didn't meet Salesforce until 2011. Jessie co-led the Seattle Salesforce Nonprofit User Group in 2015-2016. She wrote a sh*tty first draft of a novel and hopes to turn it into a screenplay!

One thought on “Converting a Lead in Flow”

Leave a Reply