Script debugger

The Script Debugger allows application developers to debug server-side JavaScript.

The Script Debugger allows each application developer to:
  • Have a dedicated debug transaction, which only applies to the current session.
  • Set and remove breakpoints.
  • Pause the current session at a breakpoint.
  • Step through code line-by-line.
  • Step into and out of function and method calls.
  • View the value of local and global variables.
  • View the value of private variables from function closures.
  • View the call stack.
  • View the transaction the system is processing.
  • Turn off the script debugger to resume running paused scripts.
The Script Debugger can pause any server-side script that runs in an interactive transaction such as business rules, script includes, script actions, or UI actions that require a response in order to proceed. If the GlideSystem method isInteractive() would return true when running the script in context, then the Script Debugger can pause it.
Note: Some script objects such as script includes can be called from multiple contexts. When a business rule runs a script include on form submit that is an interactive transaction waiting on the form data to change before continuing. When a scheduled job runs the same script include that is a non-interactive background transaction that can also run other scripts simultaneously.
To debug client-side script, you can use browser-based developers tools.
Note: For information about using Chrome to debug client-side scripts, see the blog post Using Chrome to Debug Client Side Errors by a ServiceNow Technical Support Engineer in the ServiceNow Community.

Only users with the script_debugger role can access the Script Debugger.

A debugger transaction remains open as long as the user session is valid. If a user session logs out or times out, the system closes the debugger transaction.