Running SuiteScript 2.1 Scripts in NetSuite

Run SuiteScript 2.1 scripts seamlessly using account-level preferences. Enable new functionalities without altering existing code.

·2 min read·View Oracle Docs

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:

  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.
  2. 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

  1. Navigate to Setup > Company > Preferences > General Preferences.
  2. In the Execute SuiteScript 2.x Server Scripts As dropdown, select 2.1.
  3. Click Save.

Enable SuiteScript 2.1 for 2.0 Scripts

  1. Go to Setup > Company > Preferences > General Preferences.
  2. Check the Execute SuiteScript 2.0 Server Scripts As SuiteScript 2.1 option.
  3. 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:

  1. Include the following JSDoc tag in your script file:
    suitescript
    /**
    * @NApiVersion 2.1
    */
  2. Implement other necessary JSDoc tags.
  3. 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?
To run all SuiteScript 2.x scripts as SuiteScript 2.1, navigate to Setup > Company > Preferences > General Preferences. In the Execute SuiteScript 2.x Server Scripts As dropdown, select 2.1 and click Save.
Can I use SuiteScript 2.1 features in scripts originally written for SuiteScript 2.0?
Yes, by enabling the Execute SuiteScript 2.0 Server Scripts As SuiteScript 2.1 option in the account-level preferences, scripts written for 2.0 can utilize 2.1 features if compatible.
What happens if a script is not compatible with SuiteScript 2.1 when I activate the Execute SuiteScript 2.0 preference?
Scripts that are not updated or compatible with SuiteScript 2.1 will not execute when you 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?
No, it is not necessary to manually update each script. You can either use the @NApiVersion tag in an individual script or configure your account to run all 2.x scripts as 2.1 through account-level preferences.
Source: Running Scripts Using SuiteScript 2.1 Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteScript

View all SuiteScript articles →