You need to sign in to do that
Don't have an account?
Anonymouse
How to validate if a custom picklist field currently has particular values with validation rules
Hello,
I currently have a custom picklist field with several choices. In case a user tries to edit the object, I want to make sure that the choices they may change the picklist to is limited to only a couple choices depending on what the value was originally.
I want an error to pop up in case something else was picked before trying to edit the record to "End". For instance, the only acceptable choices before changing to "End" would be either "Beginning" or "Middle."
For instance, if the original value was "Never Started," then I want an error to popup.
This is what I have currently for a validation rule:
Any help would be greatly appreciated.
Sincerely,
Jackie
I currently have a custom picklist field with several choices. In case a user tries to edit the object, I want to make sure that the choices they may change the picklist to is limited to only a couple choices depending on what the value was originally.
I want an error to pop up in case something else was picked before trying to edit the record to "End". For instance, the only acceptable choices before changing to "End" would be either "Beginning" or "Middle."
For instance, if the original value was "Never Started," then I want an error to popup.
This is what I have currently for a validation rule:
AND( ISPICKVAL( customField__c, 'End') , OR( ISPICKVAL( customField__c , 'Beginning'), ISPICKVAL( customField__c , 'Middle') ) )
Any help would be greatly appreciated.
Sincerely,
Jackie
Try this:
ISPICKVAL(customField__c,"End")
&&
NOT( ( ISPICKVAL(PRIORVALUE(customField__c),"Beginning")
||
ISPICKVAL(PRIORVALUE(customField__c),"Middle")
)
)
All Answers
Hi,
Example: For instance, the only acceptable choices before changing to "End" would be either "Beginning" or "Middle."
The Validation formula will look like this:
( ISPICKVAL(PRIORVALUE(customField__c),"Beginning")
||
ISPICKVAL(PRIORVALUE(customField__c),"Middle")
)
&&
( ISCHANGED(customField__c)
&&
NOT(ISPICKVAL(customField__c,"End"))
)
Let me know if it helps.
Thanks
I'm afraid it's still not working.
Sincerely,
Jackie
Try this:
ISPICKVAL(customField__c,"End")
&&
NOT( ( ISPICKVAL(PRIORVALUE(customField__c),"Beginning")
||
ISPICKVAL(PRIORVALUE(customField__c),"Middle")
)
)
You are my hero. :) It works beautifully!
Sincerely,
Jackie