Salesforce Tips

Display related leads in Salesforce

September 20, 2023
10 mn read
Why is it important?

When selling a software to Enterprise grade companies, you will sometimes ending up in having multiple leads filling your form from the same company.

If you do not have strict "entering" rules when lead are created to make sure that a company is managed by a single user you may encounter the situation where:

Lead 1 is assigned to User A

Lead 2 is assigned to User B

and having 2 sales Users talking to 2 different persons.

Issue with leads in Salesforce is that they're not related to an "Account" record which could easily display all the leads from a similar account.

You can definitely create a look up field on Lead to link them with Account object but you'll end up facing some challenges on lead conversion. Moreover this require either a manual input (linking the lead with the account) or to create an automated flow to automatically link the lead with an account, but you'll have to do account matching by comparing lead company name value with potential existing account with the exact same name. So if Lead 1 fills a form saying its company is Heeet and Lead 2 fills a form saying its company is Heeet France, then you'll have an issue.

How to display related leads in Salesforce.

1-Download the free Flow Datagrid Pack released by Salesforce Labs

2-Create a formula field on Lead record to extract email domain from lead email address.

SUBSTITUTE( Email , LEFT(Email , FIND("@", Email )), NULL)

3-Go to Salesforce Set Up > Flows > New Flow > Screen Flow

3.1-Create a record single variable "recordId"

3.2-Create a collection variable "varLeadIds"

3.3-Add a get element directly when the Flow is triggered. This Get element will try to retrieve existing leads that have the same email address.

3.4-Create a loop to store all the Ids of the leads that you may have found when creating the Get element.

3.5-In the loop element, add an Assignment action where you will add all the lead Ids in the "varLeadIds" variable.

3.6-After last loop record, add a screen flow.

3.7-Add the Datagrid Pack - Datatable component (available in the "custom" sections of the screen elements)

3.8-Set the API Name, pass the "varLeadIds" in the "ID List" field, choose Lead as Object API Name and then select all the lead fields you want to add to the screen (make sure you add the API field value, not the label)

That's it, you just now only need to add this screen flow on your lead lightning page.


We have an existing lead (
Another lead ( fills a form on your website.

Users will see the following information on the lead record in Salesforce and see if there are other leads from a same company. 

You can also customize this flow to:

- avoid getting all the "", "",...considered as related leads (by creating a "blacklist domain" metadata base in Salesforce)

- display custom message instead of an empty list if no related leads are found

and much more.

Feel free to contact us if you need any assistance in customizing and enhancing your Salesforce org :)

Similar posts

Check out thos related blog articles