Salesforce Educational Series #4: Process on Lead Conversion?

For the last few years, Salesforce has promoted using the combination of Process Builder and Flow to solve business problems using “clicks, not code.”

Taking this advice to heart, I have created dozens of Processes and nearly a hundred Flows in my company’s org in the last two years.

Recently, I ran across a vexing problem with Process Builder – Processes don’t seem to run after Lead Conversion. I’ve come up with a solution to this, which I’ll detail below. First, the specific problem I was attempting to solve:

Our marketing department had requested that record ownership of all Contacts on each Account be assigned to the business development representative (BDR) assigned to that Account.  I had a Process and Flow combo set up to run when Contacts are new and when the Owner field is changed. The automation runs well – except when converting a Lead to a Contact. In that instance, it doesn’t seem to run at all.

I tried using Doug Ayers’s Advanced Lead Conversion solutionhere’s the blog post – and yet if you dive further down into the comments you’ll read that this solution only works when changing the record type. Further experimentation shows that you cannot run a Process on the Lead record nor on any of the records created by Lead Conversion – not on a newly created Account, a newly created Contact, nor a newly created Opportunity.

I believe the reason the Processes don’t run after Lead Conversion must be related to the Salesforce Order of Execution. For example, if you try to run a process on the Lead record that was just converted, the new Account, Contact, and/or Opportunity records will have already been inserted. The Validation Rules on Accounts, Contacts, and Opportunities fire before your process on the converted Lead fires. Same is true if you attempt to run a Process on the new Account, new Contact or new Opportunity, it’s too late in the Order of Execution.

After converting several Leads into Contacts related to existing Accounts, I noticed in my recent items list that both the Account and the new Contact record were being listed next to each other. I noticed the Last Modified Date on each record was identical, down to the minute. Leading me to realize that the existing Account must be edited when a Lead is converted into a Contact. Aha! If an existing Account is edited, I can run a Process on that record.

The solution was to create a Flow that Looks up Account to find the BDR’s User record (stored in a custom Lookup field updated by marketing), finds all Contacts on the Accounts that are not owned by the BDR, and makes the BDR the owner of these Contacts. If the BDR’s User lookup is blank, then we assign the system User that owns all Accounts in our org to be the Contact Owner.

This Flow runs off a “just execute the actions” criteria on the Account Process, meaning it will run every time an Account record is edited and perform an update on that Account’s Contacts.

When a Lead is converted to a Contact, the Owner of the Contact will now be the BDR on the Account record.

I welcome your questions and comments below. Good luck building your solution to similar challenges!