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
Tulasiram ChippalaTulasiram Chippala 

How to stop creating a duplicate leads

Hi I have a requirement like,

1. When a new lead is creating check for Duplicates in both Lead(Based on Email and Ownerid) and Contact(Based on Email).
if found any duplicate it has to show an error message and will store that Duplicate lead in Temp_Lead__c object.
2. When a User uploading bulk leads using DataLoader or Import Wizard, insert new leads and for duplicate leads show some error and store those Leads in Temp_Lead__c.

Which approach is better, please suggest me an Idea.
Deepali KulshresthaDeepali Kulshrestha
Hi Ram,

You can write a trigger on Lead before insert. 
Or you can create a duplicate rule which can stop creating duplicate Lead. salesforce provides this functionality. 
for creating duplicate rule please go through the given link as it may help you:- 
-https://help.salesforce.com/articleView?id=duplicate_rules_map_of_reference.htm&type=5

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha