Converting a Lead in Flow

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

Features

  • 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.

Steps

  • 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.

LeadConvert

contactid

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s