define Object

The define object is an overloaded function that is used to create entry point scripts and custom modules in SuiteScript 2.x. This function executes asynchronously on the client and synchronously on the server. The define object conforms to the Asynchronous Module Definition (AMD) specification.

Note:

An overloaded function has multiple signatures. A signature is the function name and all available parameters.

SuiteScript 2.x supports the following define() signatures:

Type

Name

Return Type / Value Type

Description

Function

define(moduleObject)

object

Returns a module object based on the supplied moduleObject argument. The moduleObject argument can be any JavaScript object, including a function.

Use this define() signature if your entry point script or custom module requires no dependencies.

define(id, [dependencies,] moduleObject)

object

Loads all dependencies and then executes the supplied callback function. Returns a module object based on the callback.

Use the define() function to do the following:

For more information about custom modules, see SuiteScript 2.x Custom Modules.

For more information about entry points, see SuiteScript 2.x Script Types.

define() Function Guidelines

Use the following guidelines with the define() function:

Related Topics

General Notices