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

Jaspal Singh
Mega Patron
Mega Patron

Hi Wesley,



You can try using client script with method g_form.setValue('field_name','');


sr_surendra
Giga Expert

Hello Wesley,



I guess you might be using On change script for setting value in field "u_standard_device".


Try making appropriate changes to run this on change client script on both on load and on change


please check following for reference-


find_real_file.png


try commenting this portion of script



Regards,


Surendra


Inactive User24
Mega Expert

Hi Wesley,



Please check "Revert if false" checkbox, so that way you can revert the changes back.


File:UI Policy Eureka.png


It is already checked.