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
Imtiaz PashaImtiaz Pasha 

Hi guys i want restrict the same Mobile number entering in salesforce please can anyone help, i want to avoid duplicates.

ANUTEJANUTEJ (Salesforce Developers) 
Hi Imtiaz,


The above link has a similar use case that you can try checking out.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Hii Imtiaz Pasha
Try Below Trigger
Trigger preventDuplication on Lead(before insert, before update) {
Set<string> numSet = new Set <string>() ;
If (trigger.IsBefore) {
    If(trigger. Is Insert || trigger.IsUpdate){
        For(lead led:{

List<Lead> lstled = [select Id, Phone__c from Lead where Phone__c in :numSet];

For(Lead led2 :{
       led2.Phone__c.adderror('duplicate Number found');
Please Mark It As Best Answer If It Helps
Thank You!