+ Start a Discussion
Tulasiram ChippalaTulasiram Chippala 

What is the best way to find duplicates using trigger

I have requirement -- 
Find out the duplicate records based on Three different fields.
1. Email, 2. Phone, 3. OwnerId

if 1 and 2 satisfied but the owner is different then it has to allow for Lead creation otherwise add an Error.

How we can achieve this.
Best Answer chosen by Tulasiram Chippala
SandhyaSandhya (Salesforce Developers) 
Hi,

I would suggest you refer below link where you have the sample code for the same.

https://www.mstsolutions.com/technical/preventing-duplicate-records-based-on-multiple-fields-in-salesforce/
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
 
 

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi,

I would suggest you refer below link where you have the sample code for the same.

https://www.mstsolutions.com/technical/preventing-duplicate-records-based-on-multiple-fields-in-salesforce/
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
 
 
This was selected as the best answer
Tulasiram ChippalaTulasiram Chippala
Hi Sandya,
https://www.mstsolutions.com/technical/preventing-duplicate-records-based-on-multiple-fields-in-salesforce/
it is ok, but getting so many syntax issues in that code. It is working fine after few  modifications.