SuiteScript Hello World Fundamentals
SuiteScript Versions
Learn more about the current version SuiteScript and how it varies from previous versions:
-
Write scripts in SuiteScript 2.x, see SuiteScript 2.x Entry Point Script Creation and Deployment.
-
SuiteScript versions and SuiteScript 2.1, see SuiteScript Versioning Guidelines.
-
For a list of more SuiteScript resources, see SuiteScript.
SuiteScript Reserved Words
SuiteScript includes a list of reserved words that you cannot use as variable names or function names in your scripts; see SuiteScript Reserved Words.
SuiteScript 2.1 Script Types and Entry Points
Decide which predefined script type to use. Each script type is designed for a specific type of situation and triggering events, see SuiteScript 2.x Script Types:
-
The SuiteScript 2.x Client Script Type is for scripts that should run in the browser.
-
The SuiteScript 2.x Scheduled Script Type is for server scripts that should run at a specific time or on a recurring schedule.
-
The SuiteScript 2.x RESTlet Script Type is for server scripts that should execute when called over HTTP by an application external to NetSuite.
Available entry points are analogous to types of events. Entry points include fieldChanged(scriptContext), which represent a change to the value of a field, and pageInit(scriptContext), which represents the loading of a page.
The scheduled script type has only one entry point, called execute; it represents the point at which a schedule executes the script or a user manually executes the script.
SuiteScript 2.1 Modules
SuiteScript 2.1 has Modular Architecture.
-
The N/record Module lets you interact with NetSuite records.
-
The N/https Module lets you make https requests to external web services.
In an entry point script, load a module by using the define Object; list the modules to load as an argument of the define function.
Globally available APIs are listed in SuiteScript 2.x Global Objects.
Entry Point Scripts Versus Custom Module Scripts
The "Hello World" example script and all of its logic is contained within one script file. In SuiteScript 2.1, these supporting script files are known as custom module scripts.
The primary script file — the one that identifies the script type, entry point, and entry point function — is known as an entry point script. See SuiteScript 2.x Custom Modules.