action.execute(options)

Method Description

Executes the record action and returns the action results in a plain JavaScript object.

If the action fails, it is listed in the results object’s notifications property. If the action executes successfully, the notifications property is usually empty.

Returns

Object

Supported Script Types

Client and server scripts

For additional information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/action Module

Sibling Object Members

N/action Module Members

Since

2018.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.recordType

string

required

The record type.

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

options.id

string

required

The action ID.

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

options.params

Object

required

Action arguments.

options.params.recordId

int

required

The record instance ID.

This is the NetSuite record internal ID.

Errors

Error Code

Thrown If

RECORD_DOES_NOT_EXIST

The specified record instance does not exist.

SSS_INVALID_ACTION_ID

The specified action does not exist on the specified record type.

– or –

The action exists, but cannot be executed on the specified record instance.

SSS_INVALID_RECORD_TYPE

The specified record type is invalid.

SSS_MISSING_REQD_ARGUMENT

A required parameter is missing.

Syntax

Important:

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/action Module Script Samples and Revenue Arrangement Record Actions.

          // Add additional code
...
var myResult = action.execute({
    id: 'note',
    recordType: 'timebill',
    params: {
        recordId: 1
    }
});
...
// Add additional code 

        

Related Topics

N/action Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices