Script Tracer and debugging scripts
Summarize
Summary of Script Tracer and debugging scripts
The Script Tracer in ServiceNow Yokohama release is a powerful tool that helps administrators efficiently debug scripts and business rules by filtering and narrowing down script changes during execution. It identifies specific lines of scripts in the Glide record that have changed, saving time compared to broad searches. The Script Tracer is accessible via the left navigation pane and requires the admin role to use.
Show less
Key Features
- Filtering Options: Allows filtering by file type and specific tables to focus on relevant scripts during a UI transaction.
- Change Detection: Tracks and lists script changes in Glide records during execution, highlighting differences between old and new script states.
- State Tab: Displays only changed values by default, with an option to view all fields. Errors, including line numbers and messages, are shown prominently.
- Script and Transaction Views: Enables viewing the full script lines that changed, reviewing all transaction records related to the trace, and opening scripts for debugging or editing within the platform.
- Trace Management: Users can start and clear traces as needed, with a default line limit of 1,000 lines per trace to avoid excessive data. This limit can be customized via the property
glide.debug.trace.tracelinelimit.
Practical Use and Benefits
ServiceNow customers with admin roles can leverage Script Tracer to accelerate the debugging process by pinpointing exact script changes and related errors during execution. This focused approach reduces troubleshooting time and enhances script maintenance productivity. By managing trace limits and filtering options, users can control the volume of trace data and concentrate on relevant script segments. The ability to open scripts directly in Debugger or the platform simplifies the transition from diagnosis to resolution.
The Script Tracer can help you filter your debugging search to quickly narrow down script problems. You can identify lines of scripts in the Glide record that have undergone change during execution. Finding those specific lines of scripts rather than doing a wide search helps save time and improves productivity.
Overview of Script Tracer
- File type: Search for a specific file type
- Table: Look in the specific table for the script being executed
The Script Tracer searches for changes in the script during execution and presents them in a
list for you to examine. When you click Start Tracer, the Tracer begins
searching for changes in the Glide record. You can click the Debug Script
button at any time to see the script itself.
Use the tabs to see specific information from the Tracer.
- By default, the Show only changed values check box is enabled, so you can avoid fields that have not changed.
- To view all the fields (changed or not), you can clear that check box.
If there are any errors, they display at the top of
the State tab, with their line numbers and error message displayed in order of
occurrence.
- Script: Displays the line of changed scripts that the Glide record has undergone during execution. You can view the entire line of script by clicking the Show Script button.
- Transaction: Shows all transaction records of the trace
- Debug Script: Opens the script in Debugger to debug the script
- View File: Opens the script in the ServiceNow platform for editing
- Clear trace: Clears the trace when you are finished.
Limiting the tracer
You may want to set a limit for your trace so that you don't generate too many returns. By default there will be up to 1,000 lines of script traced. Once this number is reached you must clear the trace and start tracing again. If you want to change the maximum number of lines for tracing you can configure your limit using the property glide.debug.trace.trace_line_limit.
Since each trace you run is new, make sure you're finished reading the results of one trace before clearing it and beginning another one.
To learn more, see Debugging scripts.