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
John Manager Training DepJohn Manager Training Dep 

Validation rule on a standard object to check if the combination for field A and B already exists?

Hi Team,

I have a requirement where the new case should not be created if field A(Contact ID lookup field) & field B(custom text field) combination already exists.
Is this possible to achieve the requirement using validation rule?

I know for a fact that as on date, VLOOKUP cannot be used on standard objects.

Any constructive suggestions are much appreciated!

Hi John,

You need to create a new Field say A_concat_B__c and make sure you mark it unique.
Via workflow or Processbuilder update that field value with A+B.

Mark it the best answer if it helped
John Manager Training DepJohn Manager Training Dep
Sorry, but I missed another condition. The duplicate value(combination of field A and field B) should not be allowed when field C "is blank" or "is null".
If there is a value in field C, duplicate combination of field A and field B is allowed.

Any constructive suggession is greatly appreciated.
Write Process Builder or WorkFlow Like this
THEN: A_concat_B__c  = A + B 
ELSE: A_concat_B__c = A + B + RecordId ( WIll make it unique automatically if C is not blank)
John Manager Training DepJohn Manager Training Dep
Thanks. When duplicate record is tried to save in the A_concat_B__c, it give an email with process builder error message, and a long message on the record creation/update screen.
Is it possible to change the text of error message displayed by process builder when duplicate scenario is identified?
I am afraid if you need custom error then you have to write code in the trigger for this, if you want to avoid error email, you can write workflow.
You can create Duplicate Rule and Matching Rule
John Manager Training DepJohn Manager Training Dep
Duplicate and matching rule cannot be created on Case object.