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 one 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!

Check out our scripting blogs here!

3 Reasons You Should Switch from SuiteScript 1.0 to 2.0

There are many reasons to consider switching from SuiteScript 1.0 to 2.0. 3 reasons are modularity and compatibility with JavaScript and NetSuite’s APIs.

SuiteScript 2.0 User Event Script After Submit

In this blog we touch briefly on the 3rd and final User Event function that is available: the After Submit function. With this basic foundation of the structure and capabilities of each function, we will be ready to dive into some real life examples in the next...

SuiteScript 2.0 User Event Script Before Submit

In the last tutorial we looked at the setup of the Before Load trigger for User Event scripts. In this tutorial will introduce the basic setup of the 2nd of 3 main User Event triggers: the Before Submit trigger. I want to spend some time looking at each of these...

SuiteScript 2.0 User Event Script Before Load

User Event Scripts are one of the most common script types to work with. In the next several blogs I will walk through some example User Event scripts, and this first blog will introduce the basic setup of the Before Load trigger in a User Event script. Before Load...

Client Scripts Vs. User Event Scripts

Many of the tutorials in this series have been about the Client Script. If you have been following along, you should understand how to create and use client scripts in different basic scenarios. Now we can start touching on the basics of User Event scripts. When we...
0
Would love your thoughts, please comment.x
()
x