+ Start a Discussion
Krutik YadavKrutik Yadav 

how to make validation rule that same field of different record must not have same value

Hii Krutik
Try Below Trigger Example
trigger PreventDuplicateContacts on Contact (before insert) {
      Set <String> emailSet = new Set<String>(); 
    for (contact con:trigger.new) {
      if(Con.Email != null){        
    List <Contact> contactList = [SELECT Email,Phone FROM Contact WHERE email IN :emailSet];

    for (contact con:trigger.new) {
        If (contactList.size() > 0) {
          con.Email.adderror( 'Duplicate Contact Found. Use Existing Contact.' );
Please Mark It As Best Answer If It Helps
Thank You!
PriyaPriya (Salesforce Developers) 

Hi Krutik,

It is not possible to achieve this by configuration i.e., by writing the validation rule. So you need to write the Code i.e, trigger. 


Priya Ranjan
Salesforce Support