Reset Yes/No/--None-- variable back to --None-- after it's been answered

kdkruesel
Kilo Explorer

Have a need to reset a Yes/No variable(Included --None--) back to not answered, after it's been answered.   Will perform in a script.

Tried the following two commands but no luck.

g_form.setValue('question_2', '');

g_form.setValue('question_2', '-- None --'');

This is to be used for a catalog item with catalog client scripts.

Thanks in advance for any suggestions/help.

1 ACCEPTED SOLUTION

randrews
Tera Guru

sure use g_form.clearValue('variable name')


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Kevin,



Can you please elaborate further on what is the exact business req. Confused on why you want to reset the value after selection.


Abhinay Erra
Giga Sage

If you are trying to set it to No, here is your code


g_form.setValue(''question_2','No');


randrews
Tera Guru

sure use g_form.clearValue('variable name')


That worked great!!



Thanks for all the replies and quick responses.