1

Ran into a quick logic issue for this validation rule I'm writing. Basically, I only want to be able to save a record if there's no other Active record of the same Level. For example- if an Active record with Level = External 1 already saved, I cannot save another Active External 1, but I can save an Active with Level = External 2. Here is the logic I currently have, but the validation rule is being triggered despite there being no saved records...

AND(ISPICKVAL(Status__c, "Active"), ISPICKVAL(Level__c, "External I")) ||
AND(ISPICKVAL(Status__c, "Active"), ISPICKVAL(Level__c, "External II")) ||
AND(ISPICKVAL(Status__c, "Active"), ISPICKVAL(Level__c, "Internal"), ISPICKVAL(Type__c , "Level 2")) ||
AND(ISPICKVAL(Status__c, "Active"), ISPICKVAL(Level__c, "Internal"), ISPICKVAL(Type__c , "Level 3"))

1 Answer 1

3

Validations only know about your current record. They don't know about other records in the object. You will need to write code to query other records, and put the validation check in that code. For example in a trigger.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .