Debug Client Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 11:48 PM
Is there a way to locate the name of the client script that is responsible for a specific action such as a field value got set?
I observed that if we write to jslog() then the log message only, without the script name, appears on the JavaScript log page.
However, consider a scenario where we don’t know the client script name but some error occurred due to a specific field update. In this case, normally we need to know the name of the client script responsible for the update action along with the time of update in the log.
I found the below line from the documentation however I don't get the steps to perform them.
"Additionally, when client scripts run, the name of the client script and timing information is displayed. This can be useful in determining which scripts are running and whether they are impacting performance."
https://docs.servicenow.com/bundle/sandiego-application-development/page/script/debugging/concept/c_WritingToTheDebugLog.html
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 11:59 PM
Hi ,
You can use field watcher to check what client scripts are running on that particular field
Field watcher will give the name of client script
Please refer below thread on how to enable field watcher
Thanks,
Valmik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 12:01 AM
To navigate and point to client script that might be changing the form values, you can enable Field watcher.
You can open your form, and right click on the field label, click on "Show <field name>" context menu and the console should open to show the logs of changes.
Make sure, you have left navigation available on the form when you want to utilize field watcher
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 10:01 PM
Thanks for the response. However, I have given an example with the field update but that helped me to know that there is a way to get the client script name.
But the intent of the question is to know where can I find the client script name that is responsible for specific behavior such as performance-related issues as well. What about on-load client scripts?
An example is how to get the client script name that is the reason for slowness during on-load, submission, or modification of a form.