I have a validation rule on Custom object which validates that if Status != Draft, it should not allow the user to change the employee.
It works fine all the values which has single word like Approved, Declined, etc.. But it is not working for the values have more than one word like Under approval, under verification.
Employee_c is Lookup field Status_c is picklist
Validation Rule 01:
NOT(ISPICKVAL(Status__c, "Draft")) && ISCHANGED(Employee__c)
I have tried in different way also.
Validation Rule 02:
NOT(CONTAINS(TEXT(Status__c), 'Draft')) && ISCHANGED(Employee__c)
But still no use. can you please let me what is wrong with validation rule? or is there any known issues.
Additional Information:
WHen i am using only ISPICKVAL() it is validation rule works fine, but not with ISCHANGED.
ISPICKVAL
you need to use something likeAND(NOT(ISPICKVAL(valuefield, textvalue)),(ISPICKVAL(PRIORVAL(valuefield, textvalue)))
I've not verified this exact syntax, but it's in the ballpark (check the SF Help). I was working on something similar just a couple days ago. PICKVALS have a number of limitations that can be a PITA. If it's a multiselect Piclist, you have some other options likeCONTAINS
.