0

Suppose I have a picklist field with the values: a,b,c
These values represent stages of a record.

Is there a way I could make sure the field is upgraded only 1 value at a time without having to hardcode the picklist values in the validation rule?

Allow:

  • a -> b
  • b -> c

Disallow:

  • a -> c
  • any value going backwards

2 Answers 2

1

Nope, you'll have to define and hardcode values yourself.

Once you know how to define the values (using CASE(), most likely), the rest of your validation would simply be AND(ISCHANGED(your field), new value - old value != 1)

  • The ISCHANGED() prevents the validation rule from complaining if the value isn't changing (when new - old would be 0)
  • If your picklist is going backwards in value, new - old would be < 0
  • If the next selected value isn't the next defined value, new - old will be > 1
2
  • Thank you for your answer. Just to make sure I understood correctly, the end formula must have the CASE function for both the new and old value so It would look something like this: ISCHANGED(field_name) && CASE( field_name a, 1, b, 2, c, 3, 0 ) - CASE( field_name a, 1, b, 2, c, 3, 0 ) != 1
    – Joshua
    Commented Jun 13, 2022 at 2:38
  • @Joshua Yep, you got it.
    – Derek F
    Commented Jun 13, 2022 at 11:19
0

Alternatively, as a clumsy implementation, but with a better UX, you can have two picklists defined on an object, one dependent on the other. Both pick lists will have the same value. Display the dependent picklist on UI and when the user interacts with the dependent picklist do not forget to take action on controlling picklist (save the value in controlling picklist as well, as selected in controlled picklist may be using workflow or any mechanism of your choice).

An added advantage is, that picklist dependency is easier to manage in the future.

You must log in to answer this question.

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