OnChange Client Script to Clear Form when "Select tool" value is changed Not Working

Connie5
Kilo Contributor

For some reason the form does not clear the values when I move from one value to another value under "Select Tools" - it only works when i clear that value.

For example, if i go to choice 1 to choice 2 - some of my UI policies do not work and then the values do not clear.

If i click x and clear the "select tools" field - then select choice 1 -- it works. 

Has anyone had this type of issue before?

find_real_file.png

 

15 REPLIES 15

Prateek kumar
Mega Sage

See if this helps

https://hi.service-now.com/kb_view.do?sysparm_article=KB0647496

And also try to replace g_form.clearValue() to g_form.setValue('variablename','');


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Mark Stanger
Giga Sage

I've used 'clearValue' successfully in the catalog and service portal.  There shouldn't be any problem with your script from what I can see.  If you're experiencing problems, it's likely due to a conflict with another script or UI policy.  I would start by disabling those and testing this script to see if it works on its own.  Then you can re-enable each one in turn to try and isolate the one with the issue.  You can also check your browser console for javascript errors.

do you know what would be an example that conflicts with each other?

Coleton
Kilo Guru

Have you tried modifying the order of the script?