N/action Module

Use the N/action module to execute business logic to update the state of records in view mode. To execute business logic on records in edit mode, use the record macro APIs, which are included in the N/record Module module. See Record Object Members and Macro Object Members. Action and Macro APIs are the programmatic equivalent to clicking a button in the UI. To learn more, see Overview of Record Action and Macro APIs.

                                   

The changes that you make to records with N/action module APIs are persisted in the database immediately. For example, consider the timebill record. After you click the Approve button in the UI, the timebill and its entries are saved in an approved state, and this change is immediately updated in the database.

Governance for action module APIs varies for actions and record types. See the action help for governance information specific to actions and record types.

A limited number of individual actions for specific record types are supported. For details, see Supported Record Actions.

Note:

For supported script types, see individual member topics listed below.

In This Help Topic

N/action Module Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Object

action.Action

Object

Client and server scripts

Encapsulates a NetSuite record action.

Plain JavaScript Object

Object

Client and server scripts

A plain JavaScript object of actions available for a record type.

Method

action.execute(options)

Object

Client and server scripts

Executes the record action and returns action results in an object.

action.execute.promise(options)

Promise

Client scripts

Asynchronously executes the record action and returns the action results in an object.

action.executeBulk(options)

string

Client and server scripts

Executes an asynchronous bulk record action and returns its task ID for later status inquiry.

action.find(options)

Object

Client and server scripts

Returns a plain JavaScript object of available record actions for the given record type.

action.find.promise(options)

Promise

Client scripts

Asynchronously returns a plain JavaScript object of available record actions for the given record type.

action.get(options)

action.Action

Client and server scripts

Returns an executable record action for the given record type.

action.get.promise(options)

Promise

Client scripts

Asynchronously returns an executable record action for the given record type.

Action Object Members

The following members are called on action.Action.

Member Type

Name

Return Type/Value Type

Supported Script Types

Description

Method

Action(options)

Object

Client and server scripts

Executes the action and returns the action results in an object.

Action.promise(options)

Promise

Client scripts

Executes the action asynchronously and returns the action results in an object.

Action.execute(options)

Object

Client and server scripts

Executes the action and returns the action results in an object.

Action.execute.promise(options)

Promise

Client scripts

Executes the action asynchronously and returns the action results in an object.

Action.executeBulk(options)

string

Client and server scripts

Executes an asynchronous bulk record action and returns its task ID for later status inquiry.

action.getBulkStatus(options)

Object

Client and server scripts

Returns the current status of action.executeBulk(options) with the given task ID.

Property

Action.description

string

Client and server scripts

The action description.

Action.id

string

Client and server scripts

The ID of the action.

For a list of action IDs, see Supported Record Actions.

Action.label

string

Client and server scripts

The action label.

Action.parameters

Object

Client and server scripts

The action parameters.

Action.recordType

string

Client and server scripts

The type of the record on which the action is to be performed.

For a list of record types, see record.Type.

Related Topics

SuiteScript 2.x Modules
SuiteScript 2.x

General Notices