Executing Scripts Using SuiteScript 2.1
The Execute SuiteScript 2.x Server Scripts As account-level preference lets you specify which version of SuiteScript (SuiteScript 2.0 or SuiteScript 2.1) is used when 2.x is specified in the @NApiVersion JSDoc tag in the script. With this preference, you can execute all of your SuiteScript 2.x scripts as SuiteScript 2.1 scripts without having to make changes to any script. For more information about this preference, see Enabling SuiteScript 2.1 at the Account Level.
Currently, by default, a value of 2.x for the @NApiVersion JSDoc tag will 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, scripts with 2.x will automatically run 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 Execute SuiteScript 2.x Server Scripts As account-level preference 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.