top of page
Search

NetSuite SuiteScript 2.1 Is Released

Updated: Jul 1, 2021

As of January 2021, NetSuite has officially released SuiteScript 2.1 for public use. The beta version since 2020 and has been running to slowly replace the other version of the script. According to NetSuite, SuiteScript 2.1 is a giant step towards NetSuite’s goal of conforming to the latest ECMAScript JavaScript specification.

There are already significant benefits with the GraalJS runtime environment and how that gives SuiteScript developers access to the latest ECMAScript features and syntax out of the box. The SuiteScript 2.1 allows you to do even more with NetSuite’s customization language.

As the ECMAScript specification continues to evolve rapidly, it helps developer to improve the productivity by allowing freedom from rewriting a lot of code over and over. The expressivity and power offered by the latest standards make it possible to write modern server-side code using arrow functions, block-scoped variables, spread operators and more.


Here are some snippets of what the latest Script has provided:

a. Spread Operator & Arrow Functions


Use the spread operator (“…”) to quickly combine two objects together into a single object as shown below. Couple that with the easy-to-use arrow functions to simplify function scope.



b. Destructuring Assignment


Quickly unpack properties from an object into distinct variables using destructuring assignment.


For a complete overview of all ECMAScript features, please refer to the Netsuite Help for 2019 Specification.

There are a few more items that are as useful. Server-side scripts annotated as @NApiVersion 2.x execute as SuiteScript 2.0.

To change your scripts to use Suitescript 2.1 all you have to do is change this JSTag:

From:

1

“@NApiVersion 2.x”



To:

1

“@NApiVersion 2.1”


272 views0 comments

Recent Posts

See All

Comments


Talk to our experts to start your Automation ERP journey. Click here
bottom of page