Please use docs.servicenow.com for the latest documentation.

This site is for reference purposes only and may not be accurate for the latest ServiceNow version

Script Syntax Error Checking

From Wiki Archive
Jump to: navigation, search
Note
Note: This article applies to Fuji and earlier releases. For more current information, see Syntax Editor at http://docs.servicenow.com

The ServiceNow Wiki is no longer being updated. Visit http://docs.servicenow.com for the latest product documentation.


{{Topic|Scripting Glide and Jelly

Overview

All ServiceNow script fields provide controls for checking the syntax for errors and for locating the error easily when one occurs. The script editor places the cursor at the site of a syntax error and lets you search for errors in scripts by line number.


Script_Syntax_Check.gif

Error Checking

The ServiceNow script editor notifies you of syntax errors in your scripts when you:

  • Save a new record or update an existing record. A banner appears at the bottom of the editor showing the location of the first error (line number and column number), and the cursor appears at the site of the error. Warnings presented at Save or Update show only one error at a time.


Script_Syntax_Error_Short.gif


  • Click on the syntax checking icon before saving or updating a record. A banner appears at the bottom of the editor showing the location of all errors in the script, and the cursor appears at the site of the first error.


Script_Syntax_Error.gif

Searching for Errors by Line

To locate the exact position of the error in a large script, click the Go to line icon. This feature is particularly useful when you are encounter a syntax error in a log file rather than in the ServiceNow record itself. In this case, you can navigate to the record and search for errors by line number. In the dialog box that appears, enter the line number of an error, and then click OK. Your view moves to the site of the error, and the cursor marks the correct line and column.


Note
Note: For this feature to function, you must disable the Syntax Editor.



Script_Go_to_Error.gif