Action.promise(options)

Method Description

Executes the action asynchronously and returns the action result in a plain JavaScript object.

The action result is returned in an object. The response property of the results object shows the action result. 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.

If the Action object is qualified (it is a result of an action.get() or action.find() call that provides the recordId), then it is not required to provide a recordId and the options.params.recordId parameter is optional. If options.params.recordId is provided during execution, it takes precedence over the recordId stored in the Action object.

Note:

Replace Action with the name of the action you are executing.

Note:

The parameters and errors thrown for this method are the same as those for Action(options). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

Action(options)

Supported Script Types

Client scripts

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

Governance

None

Module

N/action Module

Parent Object

action.Action

Sibling Object Members

Action Object Members

Since

2018.2

Parameters

Note:

The parameters that are required vary for action types. The only parameter that is always required is options.recordid, unless the action object is qualified. An action object is qualified if it is the result of an action.get() or action.find() call that provides the recordId.

Parameter

Type

Required / Optional

Description

options.Object

Object

required or optional

The parameters that need to be provided depend on the action implementation. See the action help.

options.params.recordId

string

required or optional

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

This is the NetSuite record internal ID.

Errors

Error Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

A required parameter is missing.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete promise script example, see Promise Object.

          // Add additional code
...
action.promise({
    recordId: 1
}).then(function(result) {
    // Process the result here
});;
...
// Add additional code 

        

Related Topics

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

General Notices