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
Shuhbam SinhaShuhbam Sinha 

Create a validation rule

Hello Everyone, 
I need one help in writing validation rule. Requirement is -
We have six look ups of User on a custom object.When user tries to create a record each look up should have unique value , no values should be repeated . User should see an error message when he tries to create a record with duplicate lookup value. Can anyone please me on the same. 
Thanks in advance
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Shuhbam,

Did you attempt to try some logic as below.
 
OR(FIELD1__C=FIELD2__C, FIELD1__C=FIELD3__C, ....)

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
Shuhbam SinhaShuhbam Sinha
Hello Sai,
This is not working . I tried this approach earlier but getting validation error  if i try to save the record with only one value
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Shubham,

Can you share what you have tried.

Thanks,
 
Shri RajShri Raj
AND(
  COUNT(
    FILTER(
      User__c, 
      User__c.Lookup_1__c = Lookup_1__c || 
      User__c.Lookup_2__c = Lookup_2__c || 
      User__c.Lookup_3__c = Lookup_3__c || 
      User__c.Lookup_4__c = Lookup_4__c || 
      User__c.Lookup_5__c = Lookup_5__c || 
      User__c.Lookup_6__c = Lookup_6__c
    )
  ) > 0, 
  "Error: Each lookup value must be unique."
)