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

Javier Arroyo
Kilo Guru
Prior to making any changes, ensure that your script works by trying it from the browsers developer console. If it works there, then proceed with Mark Stangers' suggestion.

Coleton
Kilo Guru

I'd modify my reply but apparently all mine have to be moderated before they'll show. You have an unnecessary "or" next to the 'newValue'. Try removing that "or" and if that doesn't work, change the order numbering so that it's the last onChange to run.

Connie5
Kilo Contributor

I tried your suggestion but it still does not work 😞

Connie5
Kilo Contributor

find_real_file.png

find_real_file.png

One important thing to note: since the Jakarta release, catalog client scripts don't work in the Service Portal correctly on the UI Type "Desktop" as that's a deprecated option. You need to select either Mobile / Service Portal or All in the list.

More info on this here:

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

and here:

https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/build/service-portal/concept/unsupported_client_scripts.html

So I suspect even though the script is correct, it's not playing ball when you're attempting to try it in the Service Portal.