Script Debugger Subtabs

The Script Debugger page includes several subtabs to let you access information in your script as it runs:

Execution Log

Note:

The Execution Log subtab isn't 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 system errors. 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 you use 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 you can see them 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 iisn't 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. Don't 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 script. The function call and current line number for that function are included in the list. Use the Call Stack list to switch between 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 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 isn't used for SuiteScript 2.1 scripts. Variable watches in SuiteScript 2.1 scripts are 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 lets you add or remove variables and expressions to a list that's kept up-to-date ("watched") while your script executes.

The Script Debugger Watches tab.

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

You can also use the Watches subtab to view object properties with 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, to watch the ID of a record object (referenced by a variable called record), type record.id in the Add Watch field.

Evaluate Expressions

Note:

The Evaluate Expressions subtab isn't used for SuiteScript 2.1 scripts. SuiteScript 2.1 script logging 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. This lets you access and even change the program's state.

Enter an expression in the Evaluate Expression field and hit the Enter key to evaluate the expression at the selected call stack. The results of an evaluated expression (if any) are 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 isn't used for SuiteScript 2.1 scripts. SuiteScript 2.1 script logging 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. 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.

    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

General Notices