handle(options)

Description

Defines the function that handles a subscribed event.

Returns

Promise<void>

Since

2026.2

Parameters

Note:

NetSuite automatically passes the options parameter to the script entry point.

Parameter

Type

Required / Optional

Description

Since

options.context

Object

required

Contains context about the event.

2026.2

options.context.recordType

string

required

The record type ID of the record that triggered the event.

2026.2

options.payload

Object

required

Contains the event payload.

2026.2

options.payload.recordId

string

required

Internal ID of the record that triggered the event.

2026.2

Syntax

The following example shows the basic syntax for an Event Subscriber script entry point.

            /**
 * @NApiVersion 2.1
 * @NScriptType EventSubscriber
 */
define([], () => {
    async function handle(options) {
        const recordType = options.context.recordType;
        const recordId = options.payload.recordId;
    }

    return {
        handle: handle
    };
}); 

          

General Notices