- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2017 08:19 AM
Hello,
I am new to scripting within ServiceNow and feel like I'm missing something obvious. I am on Istanbul and need/want to use the debugger.
I have a script include that gets called on Incident Submit when a certain category is specified.
I open the script in the editor. I click the "debug" icon in the corner. The Script Debugger window opens and I see my script. I set some breakpoints.
Now I go to a different window in the same browser and submit the incident. I can see that the script was called because the appropriate things happen in the incident. But the breakpoints are never hit and the Script Debugger window still has status:
- WAITING_FOR_FIRST_BREAKPOINT
I'm pretty sure I have read everything in this community and all relevant documentation on this topic as and cannot figure out what I am doing wrong. Any help is appreciated.
MD
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- 7,113 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 03:55 PM
Ahhh, yes, that would explain the issue. Script Actions triggered by events run asynchronously and cannot be debugged directly. You have some options:
- Run the code directly in the Business Rule like you mentioned. This can be a temporary thing - keep the code in the Business Rule only until you have things working and then move it to the Script Action.
- Run the code directly in Scripts - Background. This is primarily useful if the code in the Script Include is self contained. Because you're trying to take actions on a record that was updated, this may be less viable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 02:39 PM
I'm having the same issue. I tried this in IE, FF, and Chrome...and couldn't get it to work. It shows all the breakpoints (I created many on many different lines) but simply doesn't stop on them. This is a script include and I did check the gs.isInteractive() to ensure it was one I could debug. The log messages show this is being called from the change ticket...and I'm executing this from the main browser from which I clicked the debug icon...so it should be the same session...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 03:59 PM
Hi Adam,
What is triggering the call to this Script Include? If it's a business rule, is this set to run before/after/async?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 04:05 PM
There is a UI Action which is using a glideoverlay to popup the risk assessment. Upon completion, I use a glideajax call to execute the server side script. That script then calls this script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 03:14 PM
Hi Marie,
You mentioned that this is called on Incident Submit. Is a Business Rule calling the Script Include? If so, when does the Business Rule run: Before/After/Async? Only synchronous code can be debugged - that is, code that runs as part of the current transaction. If the code is running asynchronously / in the background, the breakpoints will not get triggered.