Running Scripts Using SuiteScript 2.1
The Execute SuiteScript 2.x Server Scripts As and Execute SuiteScript 2.0 Server Scripts as SuiteScript 2.1 account-level preferences let you specify which version of SuiteScript (SuiteScript 2.0 or SuiteScript 2.1) is used no matter what @NApiVersion JSDoc tag is set in the script file. With these preferences, you can:
-
Run all SuiteScript 2.0 Server Scripts as SuiteScript 2.1 Scripts without changing the script file.
-
Run all SuiteScript 2.x Server Scripts as SuiteScript 2.1 Scripts without changing the script file.
For more information about this preference, see Enabling SuiteScript 2.1 at the Account Level.
Only script types supported on SuiteScript 2.1 will run when the Execute SuiteScript 2.0 Server Scripts as SuiteScript 2.1 preference is enabled. Scripts not yet supported in 2.1 will not be affected by this preference.
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.
There are two ways you can run 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 process as a SuiteScript 2.1 script. For more information, see Running 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 run all scripts with 2.x @NApiVersion JSDoc tag value as SuiteScript 2.1 scripts. You can use the Execute SuiteScript 2.0 Server Scripts as SuiteScript 2.1 account level preference to run all scripts with 2.0 @NApiVersion JSDoc tag value 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.