Executing SuiteScript 2.1 Scripts via Account Preferences
Execute SuiteScript 2.1 scripts using account-level preferences to enhance 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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category