action.executeBulk(options)

Method Description

Executes an asynchronous bulk record action and returns its task ID for status queries with action.getBulkStatus(options). The options.params parameter is mutually exclusive to options.condition and options.paramCallback.

Returns

string

Supported Script Types

Client and server scripts

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

Governance

50 units

Module

N/action Module

Sibling Object Members

N/action Module Members

Since

2019.1

Parameters

Note:

The options parameter is a JavaScript object. The options.params array consists of parameter objects. The values that are required in each parameter object vary for action types. The only value that is always required is recordId.

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.

options.params

array

required

An array of parameter objects. Each object corresponds to one record ID of the record for which the action is to be executed. The object has the following form:

                    {recordId: 1, someParam: 'example1', otherParam: 'example2'} 

                  

The recordId parameter is always required, other parameters are optional and are specific to the particular action.

options.condition

string

optional

The condition used to select record IDs of records for which the action is to be executed. Only the action.ALL_QUALIFIED_INSTANCES constant is currently supported.

The action.ALL_QUALIFIED_INSTANCES condition only works correctly if the author of the record action has implemented the findInstances method of the RecordActionQualifier interface. An example of such action is approve on the timebill and timesheet records.

options.paramCallback

string

optional

Function that takes record ID and returns the parameter object for the specified record ID.

Errors

Error Code

Thrown If

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

The options.recordType parameter is missing or undefined.

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.

          // Add additional code
...
var handle = action.executeBulk({
    recordType: 'timebill',
    id: 'approve',
    params: [
        {
            recordId: 1,
            note: 'this is a note for 1'
        }, {
            recordId: 5,
            note: 'this is a note for 5'
        }, {
            recordId: 23,
            note: 'this is a note for 23'
        }
    ]
});
...
// Add additional code 

        

Related Topics

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

General Notices