Relate Leads to Accounts
[ARCHIVED - See New Article Using Flow]
We have updated the Relate Leads to Accounts package to use Salesforce Flow since Process Builder is being deprecated by Salesforce. Please see the new article for instructions on how to setup the new updated version. 2.0
A common issue sales reps run into in Salesforce is the existence of leads in their database that are current customers. They end up calling the prospect trying to pitch their product and the person tells them "We are already a customer of yours". Few things are worse for a sales person than cold calling your existing customers. Leads come into Salesforce from web forms, white paper downloads, etc. and nothing is checking for whether they are a current customer or not.
We have developed an AppExchange package that relates a Lead record to an Account record by looking for a match between the Lead's email address domain and the Account's website domain. While this doesn't find all of the leads that could exist for your Accounts, it does help. Here are the components in the package:
- Account | Relate Leads by Website (Process Builder)
- Lead | Relate to Account by Email Domain (Process Builder)
- Account | Relate Leads to Accounts (Autolaunched Flow)
- Account (Custom field on the Lead object) - this is a lookup field to the Account object.
- Email Domain (Custom field on the Lead object) - this is a formula field
- Website Domain (Custom field on the Account object)
- Website Domain and Path (Custom field on the Account object)
How to Configure the App
- Install the AppExchange package into a sandbox environment.
- Go to Setup | Flows and Activate the flow called Account | Relate Leads to Accounts
- Go to Process Builder and Activate both processes: Account | Relate Leads by Website and Lead | Relate to Account by Email Domain
- Update field level security for the fields for the necessary profiles.
- Go to Leads | Page Layouts and add the Account field to your Lead page layouts.
- Go to Accounts | Page Layouts and add the Leads related list to your Account page layouts.
That's it, you are ready to test out the app!
Website Domain Fields & Formulas
Now we have to give credit to Walter Pelowski from the Salesforce developer community for the formulas he created for the fields called Website Domain and Website Domain and Path - you can see his post here. Thanks Walter!
We can see how amazing his formulas are, they solve for every scenario we have tested with. Here you can see it in action, we have Website = www.bluninjas.com/blog and the Domain correctly shows bluninjas.com.
How to see if a Lead is related to an Account
- When a new Lead is created in Salesforce or the Lead's email address is changed, the process builder called Lead | Relate to Account by Email Domain is triggered. This process invokes the flow called Account | Related Leads to Accounts. The flow looks for existing accounts records where the value in the Website Domain field matches the Email Domain field on the Lead. If it finds multiple Accounts with the same domain, it sorts the list by Last Activity Date and the most recent date is chosen as the Account to relate to the Lead. The flow then updates the Account field on the Lead.
- Here is what it looks like from the Lead:
- Now that your Lead is related to the Account, you can do things to help your sales reps out. You can show/hide text based on whether the Account is a customer so they do not call them. Or you could take it one step further and automatically convert the lead to a contact under the customer's Account record.
What Happens if an Account's Website Changes?
If you change the value of the Website on the Account, the process builder called Account | Relate Leads by Website is triggered and it will invoke the flow called Account | Related Leads to Accounts. The flow will now go down a different path and will check to see if the current Leads related to the Account have an email address domain that matches the website domain of the Account. If it doesn't match, the Account field on the Lead is updated to be blank. Then the flow looks through the other Leads and checks for matches. When it finds a match, it updates the Account field on the Lead record.
For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!