Ui action to be used twice

SG23
Tera Expert

Hi Guys, I have a scenario where I need to set a field "Type" (of Boolean type) upon clicking on the "set" button on the form.

I would like to know if I can turn my button as "Unset" and revert the change made by "Set" (clicking on set button the ui action script sets the field "Type" to true). Please suggest. Thanks.

1 ACCEPTED SOLUTION

Asal Moezi
Tera Expert

Hi,
I think easiest way to achieve this requirement is to use 2 UI Action buttons. 

  • UI Action 1: "Set"
    • Condition: current.<boolan field technical name> == true:
      • Script: 
        g_form.setValue('type'false);
            current.update();
            action.setRedirectURL(current)

    

  • UI Action 2: "Unset"
    • Condition: current.<boolan field technical name> == false:
      • Script: 
        g_form.setValue('type'true);
            current.update();
            action.setRedirectURL(current)

I hope this helps!

View solution in original post

1 REPLY 1

Asal Moezi
Tera Expert

Hi,
I think easiest way to achieve this requirement is to use 2 UI Action buttons. 

  • UI Action 1: "Set"
    • Condition: current.<boolan field technical name> == true:
      • Script: 
        g_form.setValue('type'false);
            current.update();
            action.setRedirectURL(current)

    

  • UI Action 2: "Unset"
    • Condition: current.<boolan field technical name> == false:
      • Script: 
        g_form.setValue('type'true);
            current.update();
            action.setRedirectURL(current)

I hope this helps!