NetSuite SuiteScript 2.1 Is Released
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: