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
Akash DambhareAkash Dambhare 

How to Write Apex to find out duplicate records between Lead and Opportunity?

I would like to find out a way for the system to determine that the lead (which is newly created) is already part of an open opportunity, and that the lead record should be then assigned to the same sales rep that owns the opportunity
AbhishekAbhishek (Salesforce Developers) 
You can try to create a check-box field on a Lead object and then set the Do Not Create Opportunity flag value based on checkbox selection.

For reference you can check below,
https://salesforce.stackexchange.com/questions/279278/apex-duplicates-in-list-when-adding-set-to-empty-list

https://salesforce.stackexchange.com/questions/242357/avoid-duplicate-lead-name-creating-instead-of-lead-name-update-all-details-usi

I Hope it helps.
Akash DambhareAkash Dambhare
Hey Abhishek,

Thank you so much for the information but it's not meeting my requirement.

What I want to do:

I have a lead called "ABC" and I converted that lead to Opportunity.

Now one of the Sales Rep is working on that Opportunity at the same time other lead is getting created with the same name "ABC" so now the other Sales Rep is going to call the newly created lead because he is not aware that the same lead is already converted to an opportunity.

So I'm looking to have something where I can flag on the lead that there is a duplicate record ( Opportunity ) that is currently in progress so do not call the new lead.
Ashvin JAshvin J
Hi Akash, 

While converting lead are you following any specific naming techniques for Oppotunity name ? like combination of Company or any other? 

Thanks,
Ashvin