How to prevent user to change status back to old value?

Hi, I have a column “Order Status” which is ENUM [Pending,Started,Finished,Cancelled], and
I wish to block the user to save record
when user
change from Pending to Finished, or
change from Started Back to Pending, or
change from Finished to Cancelled or
change from Cancelled to Finished or
change from Cancelled to Started or
change from Cancelled to Pending

Can any one help to advice me please, thanks.

Solved Solved
0 7 131
1 ACCEPTED SOLUTION

Hi Aurelien,

thanks for the advice and idea,

what works for me is as follow,
SWITCH([Order Status],
“Pending”, LIST(“Finished”),
“Started Back”, LIST(“Pending”),
"Finished ", LIST("Cancelled "),
LIST(“Finished”,“Started”,“Pending”)
)
when is cancelled, they can’t switch it back and
when is finished, they can’t switch it back.

solved.

View solution in original post

7 REPLIES 7

Aurelien
Google Developer Expert
Google Developer Expert

Hi @kalmen_chia

Welcome to the community.

You may wish to use the Suggested Value field, with a SWITCH expression.
Here is the documentation:

Your expression you are looking for could be something like:

SWITCH([Order Status],
   "Pending", LIST("Finished"),
   "Started Back", LIST("Pending"),
   "Finished ", LIST("Cancelled "),
   LIST("Finished","Started","Pending")
)

Please note that the last input is a default value.

Let us know if that works for you !

Hi Aurelien,

thanks for the advice and idea,

what works for me is as follow,
SWITCH([Order Status],
“Pending”, LIST(“Finished”),
“Started Back”, LIST(“Pending”),
"Finished ", LIST("Cancelled "),
LIST(“Finished”,“Started”,“Pending”)
)
when is cancelled, they can’t switch it back and
when is finished, they can’t switch it back.

solved.

Valid If instead:

(
  LIST([Order Status])
  + SWITCH(
    [Order Status],
    "Pending",
      LIST("Started", "Cancelled"),
    "Started",
      LIST("Finished", "Cancelled"),
    "Finished",
      LIST(),
    "Cancelled",
      LIST("Finished"),
    LIST("Pending", "Started", "Finished", "Cancelled"),
  )
  - LIST("")
)

Hi @Steve,

Thanks for your correction.

That distinction isn’t very clear for me: in which case is it more pertinent to use the Suggested_value, in which case it is the Valid_if ?

Suggested values produces a dropdown from which the user may choose, or the user may enter another value. Suggested values does not itself prevent the user from entering an arbitrary value. To prevent the user from entering some other value, you must use both Suggested values and Valid If, or just Valid If.

Awesome, thanks for that

Thanks all for the help.

Top Labels in this Space