Running SuiteScript 2.1 Scripts in NetSuite
Run SuiteScript 2.1 scripts seamlessly using account-level preferences. Enable new functionalities without altering existing code.
The Execute SuiteScript 2.x Server Scripts As and Execute SuiteScript 2.0 Server Scripts as SuiteScript 2.1 account-level preferences allow you to designate which version of SuiteScript (2.0 or 2.1) is leveraged, irrespective of the @NApiVersion JSDoc tag set in your script files. This flexibility is pivotal for developers looking to maximize functionality without modifying each script manually.
How Can You Run Scripts Using SuiteScript 2.1?
You have two primary approaches to execute scripts in SuiteScript 2.1:
- Run a Single Script Using SuiteScript 2.1: Use the @NApiVersion JSDoc tag in your script to explicitly define it as a SuiteScript 2.1 script.
- Run All SuiteScript 2.x Scripts as SuiteScript 2.1: Leverage the Execute SuiteScript preferences to run scripts annotated with @NApiVersion 2.x or 2.0 as SuiteScript 2.1 scripts. This method facilitates batch testing and migration without script alterations.
Setting Account-Level Preferences
To enable SuiteScript 2.1 for executions, follow these steps:
Enable SuiteScript 2.1 for 2.x Scripts
- Navigate to Setup > Company > Preferences > General Preferences.
- In the Execute SuiteScript 2.x Server Scripts As dropdown, select 2.1.
- Click Save.
Enable SuiteScript 2.1 for 2.0 Scripts
- Go to Setup > Company > Preferences > General Preferences.
- Check the Execute SuiteScript 2.0 Server Scripts As SuiteScript 2.1 option.
- Click Save.
Important Note: Only script types compatible with SuiteScript 2.1 will be executed when enabling the Execute SuiteScript 2.0 preference. Scripts that are not updated to 2.1 will not execute under this preference.
Running a Single Script
To run an individual script as SuiteScript 2.1:
- Include the following JSDoc tag in your script file:
suitescript/*** @NApiVersion 2.1*/
- Implement other necessary JSDoc tags.
- Upload and deploy your script, which will be validated as a SuiteScript 2.1 script.
For Further Learning: Explore topics such as Differences Between SuiteScript 2.0 and SuiteScript 2.1 and Debugging SuiteScript 2.1 Scripts. Enhance your development proficiency by utilizing appropriate functionalities across versions without script amendments.
Frequently Asked Questions (4)
How do I configure NetSuite to run all SuiteScript 2.x scripts as SuiteScript 2.1 scripts?
Can I use SuiteScript 2.1 features in scripts originally written for SuiteScript 2.0?
What happens if a script is not compatible with SuiteScript 2.1 when I activate the Execute SuiteScript 2.0 preference?
Is it necessary to manually update each script with the @NApiVersion 2.1 tag to run it as SuiteScript 2.1?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Custom Tool Script Enhancements in NetSuite
Custom tool scripts in NetSuite gain execution log support and a new management page in February 16, 2026.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
