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!

Build a Suitelet with the ‘ui/serverWidget’ Module Part 2

If you're new to this mini-series on how to create a Suitelet, check out our first part of the series here! How to Make Suitelets Look Like NetSuite Suitelets are an incredibly powerful tool. Not only are they great for making completely custom pages in NetSuite (like...

Build a Suitelet with the ‘ui/serverWidget’ Module Part 1

Introduction to Suitelets Suitelets are, in simple terms, a kind of page in NetSuite we can use any way we want. We can use SuiteScript modules to imitate the NetSuite user interface, or we can even use custom HTML to display our own unique information and UI....

Debugging Scripts with the SuiteScript “N/log” Module

About Logging Debugging your scripts is perhaps the most important skill as a developer, next to writing actual code. Debugging is a key to open many closed doors, and an eye to see through many thick walls. Several months ago, we made a blog about the basics of...

Using the ‘N/search’ SuiteScript Module

Searches in SuiteScript 2.0 The Search Module is an important key to coding effectively in NetSuite. Although there are numerous methods that this module supports (which the help documentation defines in detail), we will just address the three most commonly used...

SuiteScript 2.0 ‘N/currentRecord’ Module and Dynamic Mode

The currentRecord module is one of the most vital in SuiteScripting. In this tutorial, we will show some of the most important things to know as you begin using this module. Similar to the record module, the currentRecord module is one of the most commonly used...
0
Would love your thoughts, please comment.x
()
x