How to debug the script includes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2018 03:57 PM
How to debug the script includes, what are the ways are available. I tried to debug by setting break points in respective lines in script includes but not worked. Please give me a solution. I like to know.
- Labels:
-
Demand Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2018 06:36 AM
Hello
You can create your own script include to debug, similar to this
And call them like this
Or add code line like this in the script include:
gs.log('DEBUG = ' + dataToDebug);
To see the debug info go to System Logs -> System log -> Script log statements
I hope my answer has been useful
Ariel
PS: Please mark my answer correct or helpful if I have helped you. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2018 12:23 PM
What I do is gs.log in the lines of the script includes where I am having issues to know where the problem is.
For example I will log the parameter passed from client script to see if the script include got the value.
var formValue = this.getParameter('sysparm_formValue');
gs.log("Pritha says formValue " + formValue);
Your logs will appear in Script Log Statements - search this in navigation filter.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2018 12:42 PM
Hi Ramesh,
Put some log statement(gs.log('Any string')) in your script include on those lines where you suspect your code is not working and check how many logs you are getting after calling the script include. Also if you are calling it from BR then you need not to call it again and again by fulfilling the BR's condition. Alternatively you can call it from background script.
Hope this helps.
Regards
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2020 09:27 AM
Check this https://docs.servicenow.com/bundle/orlando-application-development/page/script/debugging/concept/script-debugger.html, this will help you