Script Debugger Subtabs

The Script Debugger page includes several subtabs to allow you to access information within your script as the script runs:

Execution Log

Note:

The Execution Log subtab is not used for SuiteScript 2.1 scripts. Logging of SuiteScript 2.1 scripts is done on the Chrome DevTools debugger console. For more information about debugging SuiteScript 2.1 scripts, see Introduction to Chrome DevTools for SuiteScript 2.1 Script Debugging.

The Execution Log subtab shows all execution logs created by the currently executing program, including errors logged by the system. The execution log details that appear on this subtab are the same details that would normally appear in the Execution Log on the Script Deployment page. However, when working in the debugger all script execution details appear on the Execution Log subtab on the Script Debugger page; these details will NOT appear on the Execution Log subtab of the Script Deployment page.

The type, subject, details, and timestamp are displayed on the Execution Log subtab. The timestamp is recorded on the server. It is converted to the current user's time zone for display.

Log details are collapsed by default but can be seen by clicking the expand/collapse icon. Note that the subtab is automatically cleared at the start of each debugging session.

The Script Debugger Execution Log tab.

Local Variables

Note:

The Local Variables subtab is not used for SuiteScript 2.1 scripts. Logging of SuiteScript 2.1 scripts is done on the Chrome DevTools debugger console. See Introduction to Chrome DevTools for SuiteScript 2.1 Script Debugging for more information about debugging SuiteScript 2.1 scripts.

The Local Variables subtab shows a list of all local variables (primitives, objects, and NetSuite objects) currently in scope. Note that for NetSuite objects, all properties are private, even though they can be seen on the Local Variables subtab. Do not try to reference these properties directly in your script. Use the appropriate getter/setter functions instead.

The Local Variables subtab includes a call stack that shows the current execution stack of the program. The function call and current line number for that function are included in the list. Use the Call Stack list to switch to different call stacks to view different local variables. In addition, watch expressions and expression evaluations are automatically performed in the context specified by this field.

Important:

Due to performance considerations, the member display limit for all variables is 1000. In addition, only the first 500 characters of a String are displayed. For large variables, use a watch to see the full member display (see Watches for additional information).

A sample script being debugged with a breakpoint set on a variable assignment statement and the same variable displayed on the Local Variables tab.

Watches

Note:

The Watches subtab is not used for SuiteScript 2.1 scripts. Logging of SuiteScript 2.1 scripts is done on the Chrome DevTools debugger console. For more information about debugging SuiteScript 2.1 scripts, see Introduction to Chrome DevTools for SuiteScript 2.1 Script Debugging.

The Watches subtab is where you can add or remove variables and expressions to a list that is maintained and kept up-to-date (“watched”) throughout the execution of a script.

The Script Debugger Watches tab.

The variables and expressions are always evaluated in the current call stack. This means that by default they are evaluated at the current line of script execution. However, if you switch to a different function in the call stack, they are re-evaluated at that location.

Note that you can use the Watches subtab to view object properties using a command-line interface. Any property that is viewable from the property browser can be added as a watch expression by referencing the property using dot ( . ) notation, even if the property is private in the script. For example, the ID of a record object (referenced by a variable called record ) by typing record .id in the Add Watch field.

Evaluate Expressions

Note:

The Evaluate Expressions subtab is not used for SuiteScript 2.1 scripts. Logging of SuiteScript 2.1 scripts is done on the Chrome DevTools debugger console. For more information about debugging SuiteScript 2.1 scripts, see Introduction to Chrome DevTools for SuiteScript 2.1 Script Debugging.

Use the Evaluate Expressions subtab to execute code at break points during the current program. Doing so provides access to the program's state, allowing you to modify the state of the program.

Enter an expression in the Evaluate Expression field and press the Enter key to evaluate the expression at the selected call stack. The results of an evaluated expression (if any) is displayed in the window below. Any change to the program's state is immediately reflected in the Local Variables and Watches subtabs.

The Script Debugger Evalute Expression tab.

Break Points

Note:

The Break Points subtab is not used for SuiteScript 2.1 scripts. Logging of SuiteScript 2.1 scripts is done on the Chrome DevTools debugger console. For more information about debugging SuiteScript 2.1 scripts, see Introduction to Chrome DevTools for SuiteScript 2.1 Script Debugging.

The Break Points subtab shows all your instruction-level (line) break points as well as your user event break points. Note that you can add user event break points by selecting user events from the Break on User Event list.

The Script Debugger Break Points tab.

You can set break points in your code using the Script Debugger code window. By setting breakpoints, you can execute your code up to a certain point, and then halt the execution at the break point and examine the current state of the execution.

To add/remove break points in your code:

  1. Click between the line number and the line of code to add a breakpoint:

    The Script Debugger with a break point on a log.debug statement.
  2. To remove a break point, click the break point icon as it appears in the code. You can also remove a break point by clicking the red x icon next to the break point, as it appears on the Break Points tab.

    Note that when you debug deployed scripts, you can set break points at each user event in your script. User events possibly invokable during script execution where the program halts execution.

Related Topics

Script Debugger Interface
Script Debugger Buttons
Tips for Debugging SuiteScript 1.0 and SuiteScript 2.0 Scripts

General Notices