0

I have a situation where I want to prevent (some) users from changing a picklist field once it has been set to a specific value.

I'm trying to create a validation rule that fires if the field is already set to that value - based on docs I thought that I should use:

ISPICKVAL(PRIORVALUE(Status__c), "Filled")

so that a validation error occurs when the picklist value is 'Filled'.

When I try this, and I try setting the picklist value to 'Filled' so that I can then try changing it, I get a FIELD_CUSTOM_VALIDATION_EXCEPTION error - never get to trying to change the value once it is 'Filled.

I expected it to allow the field to be changed to 'Filled' and then show a validation error if I try to change it to something else.

I'm hoping someone can shed some light on this.

1 Answer 1

4

You also need to check if the field was changed:

ISCHANGED(Status__c) && ISPICKVAL(PRIORVALUE(Status__c), "Filled")

This will let you change it to Filled, edit other fields while the Status is Filled, but won't allow changing away from the value.

1
  • Legend! thanks for that - now working as intended :-) Commented Jan 27, 2021 at 5:21

You must log in to answer this question.

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