- 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,122 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 03:49 PM
Josh,
Thanks for the reply.
Yes, it is a Business Rule. The Business Rule is running "after update", so that would make me think synchronous - but the business rule is just inserting an event into the event queue. That event has a script action and that is the place the actual code from the script include is called. So now I'm guessing that the fact that it's coming out of the event queue means that it's asynchronous.
I guess to take advantage of the debugger, I would need to move the "call" to that code directly into the business rule. Can you (or someone) confirm?
Thanks again for the assistance,
MD

- 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.