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
Sarah McMillianSarah McMillian 

Not(ISPICKVAL) Validation Rule Helpppp

I want to write a validation rule in which it only applies for a certain record type and a certain status, but then only applies if one of two other fields aren't a certain value.  Here's what I have and it's not working when I test.  It seems to be the last part that's not picking up correctly.

AND( 
RecordTypeId = "012320000009ect", 
ISPICKVAL(Status,"Completed"), 
OR(NOT(ISPICKVAL(Resolution_Attempt_Status_1__c,"Completed")),NOT(ISPICKVAL(Attempt_2_Result__c,"Completed"))) 
)
Best Answer chosen by Sarah McMillian
DavidGantDavidGant
Sarah,

Since both of the last two conditions are looking for something not to be true, would removing the OR meet the need?
AND( 
RecordTypeId = "012320000009ect", 
ISPICKVAL(Status,"Completed"), 
NOT(ISPICKVAL(Resolution_Attempt_Status_1__c,"Completed")),
NOT(ISPICKVAL(Attempt_2_Result__c,"Completed")) 
)
The formula above will fire if the record type matches, the Status is "Completed", and either (or both) of the picklists is not set to Completed. 

All Answers

DavidGantDavidGant
Sarah,

Since both of the last two conditions are looking for something not to be true, would removing the OR meet the need?
AND( 
RecordTypeId = "012320000009ect", 
ISPICKVAL(Status,"Completed"), 
NOT(ISPICKVAL(Resolution_Attempt_Status_1__c,"Completed")),
NOT(ISPICKVAL(Attempt_2_Result__c,"Completed")) 
)
The formula above will fire if the record type matches, the Status is "Completed", and either (or both) of the picklists is not set to Completed. 
This was selected as the best answer
Sarah McMillianSarah McMillian
That did the trick!  Than you very much!
DavidGantDavidGant
Glad it worked. Please make sure to mark a best answer.
Mags Doheny 5Mags Doheny 5
This works for me too, but i don't understand why it behaves like an OR instead of AND when it's negated! Thank you :)