In the field of business management software, NetSuite stands out as a robust cloud-based solution that aids organizations streamline and organize their operations and finances. While NetSuite offers a wide array of built-in features, there are some particular cases where businesses require customizations to align the system with their unique requirements. This is the point where SuiteScript comes into play. SuiteScript, a scripting language based on JavaScript, helps users to extend and customize NetSuite’s functionality by writing and executing custom scripts.
At its core, SuiteScript is a scripting language that offers a powerful toolkit for developers and administrators to create custom workflows, automate tasks, and enhance or improve various aspects of NetSuite. Built on JavaScript, SuiteScript leverages its syntax and constructs while introducing NetSuite-specific APIs and objects.
SuiteScript 1.0: The Foundation
SuiteScript 1.0 was the original scripting language that was introduced by NetSuite. It provided developers with the tools that were necessary to customize and also extend NetSuite’s functionality. Here are some of the defining characteristics of SuiteScript 1.0:
Syntax and Structure: SuiteScript 1.0 follows the syntax of ES 5 and uses global functions and objects extensively. However, the structure and organization of those scripts were relatively less modular and reusable.
Script Types: SuiteScript 1.0 included three main script types: User Event scripts, Client scripts, and Scheduled scripts. Each script type had specific triggers and execution contexts, determining when and how the scripts would run.
Record-Level APIs: SuiteScript 1.0 primarily interacted with records and data using a record-level API approach.
Limited Object Orientation: SuiteScript 1.0 had limited support for object-oriented programming paradigms. The scripting language also lacked native support for classes, inheritance, and other advanced concepts.
JavaScript Engine Used: SS 1.0 is based on Rhino JS engine and Rhino doesn’t support the latest ECMA script specifications, only providing support till ES 5. It should be noted that Rhino is depreciated now.
SuiteScript 2.0: The Next Generation
SuiteScript 2.0 introduced significant improvements over its predecessor, enhancing the development experience and expanding the capabilities of NetSuite customization. In the following we provide an overview of the key features and advancements in SuiteScript 2.0:
Modular Architecture: SuiteScript 2.0 adopts a more modular and organized approach to scripting. It introduces modules, allowing developers to encapsulate logic and reuse code efficiently. This promotes better code organization and maintainability.
Script Types and Entry Points: SuiteScript 2.0 maintains the same script types as SuiteScript 1.0 (User Event, Client, and Scheduled). However, it introduces the concept of entry points, allowing developers to define specific functions for different script triggers, providing more granular control over script execution.
Object-Oriented Programming (OOP): SuiteScript 2.0 embraces object-oriented programming principles, introducing classes, inheritance, and other OOP concepts. This enables developers to write cleaner and more structured code, improving code reusability and scalability.
Promises and Async/Await: SuiteScript 2.0 leverages JavaScript’s modern features, such as Promises and Async/Await, to handle asynchronous operations more elegantly. This simplifies complex workflows and ensures better control over asynchronous tasks.
Increased API Coverage: SuiteScript 2.0 expands the suite of APIs available for developers. It introduces new APIs, such as the N/query API for querying records and the N/http API for making HTTP requests, providing greater flexibility and access to NetSuite functionalities.
Differences from Suitescript 2.1: SuiteScript 2.1 uses a different runtime engine than SuiteScript 2.0, it also supports ECMAScript language features that are not supported in SuiteScript 2.0. This causes some capabilities in SuiteScript 2.0 scripts to function differently when the script is executed using SuiteScript 2.1. Additionally, Suitescript 2.1 uses GraalVM engine that is supported till ES 10.
About the Author
Arbaz Khan
Software Engineer - Folio3
Arbaz Khan is a bronze-medalist software engineer having experience working with NetSuite. He loves reading books, watching movies and well, and writings blogs