Assign a Lead in Salesforce based on existing Contact Owner

Lead Assignment Rules in Salesforce are useful, but fairly limited. For example, one of the things you can’t do is assign a new Lead to the same owner of an existing Contact in Salesforce.

Why might you want to do this? Well, let’s say your business uses Web-to-Lead functionality where customers/prospects fill in an enquiry form on the website and their enquiry automatically gets created as a new Lead in Salesforce. What happens if that customer has bought from your business before, and dealt with a specific sales person? You might want the customer’s repeat business to be automatically assigned to the same rep.

Lead Assignment Rules don’t allow this kind of Named Account/Contact assignment, even though apparently themselves operate such a named account policy in their sales organisation.

In the Salesforce Trailblazer Community, lots of people ask how to assign Leads to appropriate Account/Contact owners (as in this post), and there are a few apps in the Salesforce AppExchange that provide the functionality at a price.

Here’s a way to implement a simple version using Process Builder and Visual Workflow. It uses just four elements in a Flow which searches existing Contacts for an email address, and a simple Process that fires when a new Lead is created. This works for existing Contacts, but it would be easy to extend to existing Accounts if you need to.

Create the Flow

The Flow we are going to create uses just four elements: an sObject Variable that contains the Lead that gets passed in from Process Builder, a Record Lookup to search existing Contacts for the Lead’s email address, a Variable to store the found Contact’s OwnerID, and a Record Update to save the Contact’s OwnerID to the Lead.

In this blog post I’ve name the Flow ‘Search Contacts for Email Address’.


Use the Resources Tab in Flow Designer to create an sObject Variable. This will be used by Process Builder to pass the Lead record to the Flow when a new Lead is created.


Use the Resource Tab in Flow Designer to create a Variable. This will be used by the flow to store the OwnerID from an existing Contact.


From the Palette Tab in Flow Designer, drag a new Record Lookup element onto the Canvas. This will be used to search for any existing Contact that has the same email address as the new Lead, and obtain the Contact’s Owner ID. This Element needs to be set as the Start Element in the Flow.


From the Palette Tab in Flow Designer, drag a new Record Update element onto the Canvas. This will be used to save the Contact Owner ID back to the new Lead record.


That’s it in terms of Visual Workflow configuration. Make sure you activate the new Flow so you can see it in Process Builder in the next step.

Create a Process

In Process Builder, create a new Process that starts when a record changes. In this blog post I’ve named the Process ‘Assign Lead Owner’.


Choose the Lead object as the object for which you wish to start the Process, and specify to start the Process only when a record is created.


Define criteria for a new Action Group, and set the condition so that the Action Group is only executed if the Email Address on the new Lead record is not null.


Finally, configure the Action Group to launch the Flow you created earlier in this blog post, and set the Flow sObject Variable ‘NewlyCreatedLead’ to Lead. If you correctly setup the Flow in the previous steps in this blog post (and activated it), everything should be selectable from within Process Builder.


Remember to activate the new Process.

Now, whenever a new Lead record is created in Salesforce, a check will be carried out to see if there is a matching Contact with the same email address. If there is, the new Lead will be assigned to the Owner of the existing Contact. Otherwise, the new Lead will be assigned to the user creating the Lead.

Limitations of this solution

This isn’t a perfect solution. One of the limitations is that the Owner of the original Contact could have moved on, and is no longer an Active User in Salesforce.

Another limitation is the fact that the Lead must have an email address matching an existing contact. A more flexible solution might be to attempt a match a Lead’s Email domain against the Website domain on an Account, which could enable any new Leads for an existing Account to be assigned to the Owner of the Account.

Has this helped you?

I hope this post has been useful. If it has helped you, please share the love with your Salesforce Ohana and leave a comment and/or share this post!

4 thoughts on “Assign a Lead in Salesforce based on existing Contact Owner

  1. Works great. I already had created Trigger that looks for Existing Contact Emails and matches that against Lead Email and updates the Lead Owner through Process Builder.

    But with this I am going a step further by adding Domain Name as you mentioned above which works. My struggle is I need another Record Lookup where it finds Account.Name that should contains Lead.Company OR = Lead.Company. How should I go about? Would I need Decision/Assignment Palette for this?

    I need to have all these in one Flow instead of creating multiple ones.

  2. Thanks a million for this post. So straightforward and it allowed me to put this in place when our dev partner said it would be a ton of work. Had it done in 15 minutes!

What do you think?

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

You are commenting using your 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 )

Connecting to %s