Speed Up Business Functions through New Asynchronous Programming in SuiteScript

Ashwin Krishnamurthy, Senior Product Manager, SuiteCloud Platform

March 15, 2021

In 2007, Jeff Atwood, cofounder of Stack Overflow, said this:

“Any application that can be written in JavaScript, will eventually be written in JavaScript.”

This quote holds true even today, as JavaScript continues to evolve and now runs on platforms everywhere, not just on the browser. And as NetSuite partners and customers build ever more powerful applications using SuiteCloud Platform technologies, there is a corresponding need to scale while providing excellent response times and throughput. In particular, the platform needs to scale when working with larger data sets on the server side.

To better support a modern JavaScript development experience with NetSuite’s SuiteScript programming language, SuiteScript version 2.1 introduces support for non-blocking asynchronous promises in server-side applications. It is now available in NetSuite 2021 Release 1.

In earlier SuiteScript versions, all server-side code executes synchronously. In other words each line of code must complete its execution in sequence prior to the subsequent line.


const P1 = https.get.promise({ url:”foo"}) //Line 1

const P2 = https.get.promise({url:bar}) //Line 2


In the mock snippet above, the HTTPS call on Line 2 only executes after the HTTPS call on Line 1 completes. Now imagine scenarios where an application is running an I/O intensive operation such as a search request through the N/query module or is waiting for results from an N/https call or is simply processing multiple transaction entries. Each of these synchronous calls entails what is known as “blocking code.” This means that execution flow is blocked until a costly operation such as a network call or database operation completes, which takes a finite amount of time until the next call can execute.

Knowing that it would be much more valuable if both could execute at virtually the same time, NetSuite has introduced server-side promises (notably this capability is already available for client-side script processing in supported browsers like Chrome). Promise-based variants of I/O intensive SuiteScript APIs such as http, https, query etc. (refer to the documentation link(opens in new tab) for full details) executed on the server-side can now benefit from non-blocking execution and run in tandem. Performance testing results indicate that programs developed using asynchronous techniques like promises result in up to a 50% improvement in end-to-end execution time.

Additionally, SuiteScript also supports functions like async await, allowing developers to develop complex business logic in JavaScript and import third party libraries that conform to this ECMAScript-standard syntax.
Support for asynchronous JavaScript development opens new avenues for richer, better performing applications built with SuiteScript. Here are a few resources to learn more (requires logging in to your NetSuite account):

Want to learn more about NetSuite 2021 Release 1?

Any customer that has gone through previous NetSuite refreshes knows that no blog post can do justice to all of the new functions and capabilities in NetSuite 2021 Release 1.

For a more complete picture of what new features are in this release, be sure to read the release notes(opens in new tab). And if you’re new to the release process, learn more about that in SuiteAnswers(opens in new tab).

Most importantly, don’t forget to request access to your Release Preview(opens in new tab) test account. Nothing substitutes for getting to test how all the new features will work with your data, workflows and customizations.

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation.

Results are based on in-process and distinct operations. For bulk-processing scenarios, out-of-band solutions like work queues may offer better performance.

NetSuite has packaged the experience gained from tens of thousands of worldwide deployments over two decades into a set of leading practices that pave a clear path to success and are proven to deliver rapid business value. With NetSuite, you go live in a predictable timeframe — smart, stepped implementations begin with sales and span the entire customer lifecycle, so there's continuity from sales to services to support.