Executing Scripts Using SuiteScript 2.1
You can use an account-level preference, Execute SuiteScript 2.x Server Scripts As, to specify that the 2.x value in the @NApiVersion
JSDoc tag should represent SuiteScript 2.1 and not default to SuiteScript 2.0. With this preference, you can execute all of your SuiteScript 2.x scripts as SuiteScript 2.1 scripts without having to make any changes to any script. This preference lets you specify which version of SuiteScript the 2.x value maps to (SuiteScript 2.0 or SuiteScript 2.1). For more information about this preference, see Enabling SuiteScript 2.1 at the Account Level.
Currently, a value of 2.x for the @NApiVersion
JSDoc tag will, by default, resolve to 2.0 when the script is uploaded and executed. This means that all scripts that include @NApiVersion
2.x are executed as SuiteScript 2.0 scripts. In a future release, this will change so that scripts annotated with 2.x will automatically execute as SuiteScript 2.1 scripts, by default. When this happens, account administrators will receive notifications that 2.x annotated scripts will begin executing as SuiteScript 2.1 scripts. Notifications will be sent to account administrators if there is at least one script in their account that is annotated with the @NApiVersion
JSDoc tag value of 2.x.
There are two ways you can execute your scripts using SuiteScript 2.1:
-
Execute a single script using SuiteScript 2.1 — You can use the
@NApiVersion
JSDoc tag in your script file to indicate explicitly that the script should execute as a SuiteScript 2.1 script. For more information, see Executing a Single Script Using SuiteScript 2.1. -
Execute all SuiteScript 2.x scripts using SuiteScript 2.1 — You can use the account-level preference, Execute SuiteScript 2.x Server Scripts As, to specify that all scripts that specify 2.x for the
@NApiVersion
JSDoc tag value should execute as SuiteScript 2.1 scripts. For more information, see Enabling SuiteScript 2.1 at the Account Level.
For more information about the @NApiVersion
JSDoc tag, see SuiteScript 2.x JSDoc Validation.