UI Policy - Run Script to clear form field value when condtion is reversed.

Wesley Breshear
Tera Expert

Hello,

I am trying to clear the value(s) of a Service Portal form when the user reverses their selection.   On our Mobile Phone Request form, a user may select "New" or "Upgrade" as a request type at the beginning which will make some fields visible based on their selection and they may input data into these fields.   If they choose to switch their request type, some fields will disappear with their input selections while others reappear asking for new or different input.   When this occurs I want to blank their values or reset the fields back to an initial state so they are not submitted with the form variables of the request catalog item.   This has caused confusion for when completing tasks because the form variables have input for both request types.

I have tried various g.form methods but not able to get any to work.   Can you please assist with the proper code to blank/reset.

UI_Policy_Run_Script.jpg

Thank you,

-Wesley

1 ACCEPTED SOLUTION

It should be g_form.clearValue('u_standard_device');


View solution in original post

8 REPLIES 8

Hi Wesley


From your screenshot it looks like you have put g.form but it should be g_form


It should be g_form.clearValue('u_standard_device');


Crikey, I feel stupid!



I had tried so many other commands then when I typed it g_from didn't even noticed that used a period vs. underscore.



Thanks


-Wesley



kkaria
Mega Explorer

What if I don't want to clear the value but want to set it back to the default. i.e. the default i designated at the time of creating the variable.Thanks.