Possible to have a UI action revert the "State" to its previous choice instead of a set choice?

C_dric Chen
Tera Contributor

Greetings, everyone.

 

So, I'm trying to configure a pair of UI actions: "Place on hold" and "Resume working". What I'm trying to achieve is: When I click on "Resume working", I want it to revert the "State" to its previous choice, i.e. the choice of "State" when I clicked on "Place on hold". Examples:

  • If the State was "Work in progress" when I clicked on "Place on hold", then, when I click on "Resume working", I want the State to be reverted to "Work in progress".
  • If the State was "Work in progress" when I clicked on "Awaiting additional info", then, when I click on "Resume working", I want the State to be reverted to "Awaiting additional info".

 

Would anyone be kind enough to point me at the right direction?

 

Thank you in advance!

1 ACCEPTED SOLUTION

Ct111
Giga Sage

Your example seems to me like the one that is discussed in this thread.

Check it once

View solution in original post

2 REPLIES 2

Ct111
Giga Sage

Your example seems to me like the one that is discussed in this thread.

Check it once

Gary Fawcett1
Tera Guru

I would create a on Change Client script that stores the previous value of the state.

This example uses the description field to store the value, but I would recommend you create a new variable on incident table.  You can then reference this value when the UI actions runs to restore the old value?
Thanks...Gary

Code:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
g_form.setValue('description',oldValue);
}