function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anas AlamourAnas Alamour 

get duplicated leads with different sources

I have a requirment to generate a report for the duplicated leads in our system with the same lead's email address and the one of the lead source in the duplicaed equal "Option1" and the lead source in the other  duplicated leads equal "Option2" . I used the following SOQL query : 

SELECT Count(Id), Email FROM Lead where  LeadSource IN ('Option1','Option2') GROUP BY Email HAVING Count(Id) > 1

I got all the duplicated leads , but my requirment is getting the duplicated  for both options "Option1" and "Option2". we don't need to get the duplicated where the source is equal Option1 or Option2 in both duplicated leads. 

 Is that possible with SOQL or i need Apex code. Please help. 

Thanks. 

AnkaiahAnkaiah (Salesforce Developers) 
Hi Anas,

Please refer the bekow article will help you to proceed further on your requirement.

https://reportforce.blog/2020/09/01/reporting-on-duplicate-records/

Thanks!!
sophia josephsophia joseph
Hi Anas,

I also have a same kind of issue regarding lead generating (https://polygelnailkit.shop/). I am keeping an eye on your query so that as soon as you get some relevant answer it might be helpful for me too.