Relate Leads to Accounts Using Salesforce Flow
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 | Related Leads Based on Website Email Domain (Record-Triggered Flow)
- Lead | Relate to Account by Email Domain Flow (Record-Triggered Flow)
- Account - Lead | Relate Leads to Accounts (Record-Triggered 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 following flows:
- Account | Related Leads Based on Website Email Domain
- Lead | Relate to Account by Email Domain Flow
- Account - Lead | Relate Leads to Accounts
- 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 flow called Lead | Relate to Account by Email Domain Flow is triggered. This flow invokes the subflow called Account - Lead | Relate 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.
For any questions, comments, concerns – let us know in the comment section below!
We would love to hear from you!