SuiteScript 1.0 vs 2.0

Whether you are new to the NetSuite developer community or a grizzled NetSuite vet, you have at some point probably asked the question, “Which SuiteScript API should I use?”. SuiteScript 1.0, as the legacy system, was introduced around 2005 and is still used by many businesses, while SuiteScript 2.0 was initially introduced in NetSuite Update 2015.2. Which one is better? This blog hopes to answer that question once and for all.

Reason 1: Modularity

In SuiteScript 1.0, scripts tend to get messy quickly, especially for eyes unfamiliar with the 1.0 syntax. Anyone who has seen a 1.0 script will immediately notice the incessantly repeated phrases, “nlapi…” or “nlobj…”, covering almost every square inch of the screen. SuiteScript 2.0 eliminated these phrases and replaced them with something called “modules.” These modules typically appear at the top of the script and specify which NetSuite APIs should be imported for the script’s use.

This coding paradigm shift is part of a larger movement in software development, commonly referred to as “Object Oriented Programming.” Object-Oriented Programming (or “OOP” for short) is a modular method of scripting that provides several improvements. First, OOP makes development much more intuitive to organize. Each section of code (or “object”) is organized into relatively small blocks which are formed together to create larger blocks—hence the term, modularity. This modularity enabled SuiteScript to import external libraries and custom modules into a script. It also made SuiteScript much more intuitive for the average JavaScript developer entering the SuiteScript world. A second benefit of Object-Oriented Programming is that it makes scripts more efficient. Rather than importing every API of an ecosystem (as SuiteScript 1.0 did), scripts can now select only the APIs necessary, leading to improved automation efficiency.

Reason 2: Compatibility with JavaScript Updates

Although NetSuite typically tends to lag a few years behind the latest developments in JavaScript, SuiteScript 2.0 brought compatibility to some important JavaScript functionality. The most notable of these improvements was the ability to include JavaScript “Promises” in a script. “Promises” essentially make a script significantly more efficient by running functions asynchronously. In the future, NetSuite will continue to improve the 2.x line of SuiteScripting and bring further support for contemporary JavaScript syntax. For instance, the coming release of SuiteScript 2.1 will include support for arrow functions, the spread operator, and other helpful features for developers.

Reason 3: Compatibility with NetSuite’s New APIs

SuiteScript 2.0 also brought an entirely new API for NetSuite development—the Map/Reduce module. Standing on the shoulders of the Mass Update module, Map/Reduce allows developers to update greater amounts of data in NetSuite in a shorter amount of time. This is made possible because of the asynchronous functionality of the Map/Reduce API. There will also likely be more NetSuite APIs developed for SuiteScript 2.0 in the future.

Conclusion

In summary, SuiteScript 2.0 makes NetSuite development much easier, cleaner, and more efficient. SuiteScript 2.0 is an all-around improvement to the SuiteScript environment. The modularity provides a cleaner interface, making it easier to read and create scripts. The compatibility with JavaScript and NetSuite’s APIs ensures that you are getting the latest functionality and performance improvements. At SuiteRep, we look forward to additional improvements to the NetSuite ecosystem in the future.

Does your company still use SuiteScript 1.0? Allow us to help you transition to modern SuiteScripting with an optimized, fast, and efficient NetSuite instance running on SuiteScript 2.0. Reach out for a free consultation to start the New Year out strong and truly harness the power of NetSuite!