Entry Point Script Validation Guidelines

For an entry point script to be valid, its structure must meet certain requirements. If it does not meet all requirements, you can't create a script record for the script, and you can't attach the script to a form. In some cases, you won't be able to upload the script file to the File Cabinet if all requirements are not met.

Note:

If a correctly formatted script is already attached to a custom form or has a script record, you can't edit and save changes to the script file that would introduce errors.

For more information, see the following:

Entry Point Script Validation Terms

When learning about script validation requirements and errors, it is important to understand certain terms. These terms are described in the following illustration and table.

Script components for validation.

Callout

Description

1

JSDoc tags

2

JSDoc tag values

3

Entry point function definitions

4

Script type interface (or simply interface)

5

Entry points

6

Entry point functions (also called script type functions)

At a high level, the following rules apply:

Required Structure for Entry Point Scripts

An entry point script cannot be associated with a script record or custom form unless it meets certain requirements. For the script to be valid, these requirements must be met:

Required JSDoc Tags for Entry Point Scripts

Every entry point script must contain the @NApiVersion and @NScriptType JSDoc tags described in the following table. This table includes information about some possible validation errors. For more information about validation errors, see Entry Point Script Validation Error Reference.

JSDoc Tag

Valid Values

Purpose

Possible Validation Errors

@NApiVersion

2.0

2.1

2.x

2.X

Identifies the SuiteScript version to use.

2.x and 2.X are equivalent.

  • FAILED_TO_VALIDATE_SCRIPT_FILE — If you omit this tag within a script file that is otherwise properly formatted, you will receive this error when you upload the script file to the File Cabinet.

  • INVALID_API_VERSION — If you use an invalid value for this tag, you will receive this error when you upload the script to the File Cabinet.

@NScriptType

BundleInstallationScript

ConsolidatedRateAdjustorPlugin

CustomGLPlugin

ClientScript

EmailCapturePlugin

MapReduceScript

MassUpdateScript

PaymentGatewayPlugin

PluginTypeImpl

Portlet

PromotionsPlugin

Restlet

ScheduledScript

ShippingPartnersPlugin

Suitelet

TaxCalculationPlugin

UserEventScript

WorkflowActionScript

Identifies the type of script defined in the file.

  • WRONG_SCRIPT_TYPE — If you specify a value that is incompatible with the entry points included in the script, you will receive this error when you upload the script file to the File Cabinet.

  • FAILED_TO_VALIDATE_SCRIPT_FILE — If you omit this tag within a script file that is otherwise properly formatted, you will receive this error when you create a script record for the script or attach the script to a form. You can upload the script file to the File Cabinet.

For more information about working with JSDoc tags in SuiteScript 2.x, including details on the correct format, see SuiteScript 2.x JSDoc Validation.

Tip:

If you are currently using SuiteScript 2.0 for your scripts, consider updating your scripts to use SuiteScript 2.1. SuiteScript 2.1 includes new language features that are provided by the ECMAScript 2019 specification. For more information, see SuiteScript 2.1 and SuiteScript Versioning Guidelines.

Related Topics

SuiteScript 2.x Entry Point Script Validation
Entry Point Script Validation Examples
Entry Point Script Validation Error Reference
SuiteScript 2.1
SuiteScript Versioning Guidelines

General Notices