We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to set the select box value to none or clear the select box

Pranay Verma
Tera Contributor

I want to clear the select box value after clicking ok in alert message.

 

I have written the below script but it's not working.

PranayVerma_0-1681363735881.png

 

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@Pranay Verma 

try to use g_form.clearValue('variable/field name');

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

We have used g_form.clearValue('variable/field name'); 

but it is not working.

Aziz GUEYE
Tera Contributor

Use this alternative

g_form.setValue("variable_name", []);

Please check and let me know if still facing the issue.