I have condition i.e. User can select 'Completed' Stage__c if prior value is either "Sent To Customer" or "Rejected".
In order to Achieve this I have created below validation rule:
AND(
ISCHANGED(Stage__c),
ISPICKVAL(Stage__c, "Completed"),
OR(
!ISPICKVAL(PRIORVALUE(Stage__c), "Rejected"),
!ISPICKVAL(PRIORVALUE(Stage__c), "Sent To Customer")
)
)
if I just check one Stage prior value then it works but adding two conditions like
AND(
ISCHANGED(Stage__c),
ISPICKVAL(Stage__c, "Completed"),
OR(
!ISPICKVAL(PRIORVALUE(Stage__c), "Sent To Customer")
)
)
Can anyone tell me what am I doing wrong? Is there any other way I can achieve this? Am I using OR wrong way?
Forum Ambassador Steven Trumble (Strum Consulting)
It's not working because you have two NOT in your OR, so this will always return true.
If prior stage was rejected then Not "sent to customer" is true, if prior stage was not sent to customer then not rejected is true. If prior stage was anything else then they are both true