- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:12 PM
Guys ,
What could be the reason ?? for debug mode is not working !
I have chuck of code trying to debug but looks like it's not working ...can someone help me with it ?
Many thanks for your help !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 01:15 AM
Hm the code you've shown doesn't look much like a Script Include to me though.
Try to create a new Script Include and put everything in a function there (even in the 'initialize' should be ok) and add the breakpoints there.
Afterwards run 'new MYSCRIPTINCLUDE();' in a background script (if you placed the code just inside the initialize function). Then your breakpoints should trigger.
You cannot debug directly from a scheduled job because they will not run in your "Session" (they will run in the background by ServiceNow).
Btw: Please make sure that the Scheduled Job has the proper 'run_as' value (you have to edit this field via list-edit) - by default the user who creates the scheduled job is put in there. But if for some reason this account is ever getting deleted, the scheduled job will no longer run (so you need some kind of technical "ever existing" user account that will run scheduled jobs).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:16 PM
Thats very little information you are providing, can you please share the code snippet you are trying to debug?
Is it client side or server side? Are you debugging with gs.info or break points?
If you are talking about the Script Debugger not opening - try loggin in and out, additionally check if your browser is blocking the popup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:27 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:35 PM
Hi Zosy,
The breakpoints seems be set. What is not working? Is the execution not stopping at the breakpoints? Are the values not being displayed?
Chuck has a video on Debugging.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:39 PM
Thanks for your reply. Is a business rule? I think we need more context on e.g. how the execution of this script is triggered.
Additionally as a general improvement, consider using the IIFE-Pattern (Mozilla Doc😞
/*global gs, GlideRecord, sn_compliance */
/*eslint no-undef: "error"*/
(function () {
// put your script in here
// only if placed in here you will get proper syntax highlighting
// additionally, thanks to the eslint settings, you will be informed of typos :-)
})();