Could any one guide us the best approach to find the duplicates using with own filters not salesforce Duplicate Rules.

We have pushing leads to Salesforce from external tool.We want restrict the duplicates with own filters before push to SF.

Presently, we follow the below approach.

1)Filter set up

example : (Company AND Phone)

2)Check duplicates using above filter using SOQL through REST API

Select id,name,company from Lead where company ='Salesforce.com' AND phone='1235645698';

In Our tool,We pushing bulk leads also .In this case,one API call consume for each lead to check the duplicates.

Is there any alternative approach to find the duplicates using self filters not Salesforce native duplicate management.

  • Why don't you write these filter and stop insertion of duplicate records? Jun 28, 2018 at 11:31

1 Answer 1


If you can't do this on Salesforce (or just don't want to) you can query using the IN keyword. So if you have, for example, three leads from different companies, you can fire the following query:

SELECT Id, Name, Company, Phone
WHERE Company IN ('Company A', 'Company B', 'Company C')
AND Phone IN ('99999', '99998', '99997')

This way, you can retrieve multiple records and then flag which leads you have that you do not need to send to Salesforce.

This isn't a good approach because you will be facing two limits:

So, instead of doing this filtering outside Salesforce, you should consider using Duplicate Rules on the Lead object (on Setup > Duplicate Management > Duplicate Rules), and then uploading all the unfiltered data you have (unfiltered for duplicates, that is).

  • Thanks for your info.My client don't want use Duplicate Rules in SF.So we can provide a option to set up filter at our end.People import tool scan the duplicates using self filters.Please see below video for reference. [youtube.com/watch?v=pZDDh_t_L_U] I'm thinking there is a possibility to scan the duplicates using Salesforce API Jun 29, 2018 at 6:06
  • Like I said, if you don't do this on Salesforce, you'll have to get the data from your customer, then get the existing data on Salesforce, and then apply your filtering. After removing the duplicates, you can upload this data to Salesforce. All this using the existing APIs, of course. Jun 29, 2018 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .