Action.executeBulk(options)

Method Description

Executes an asynchronous bulk record action and returns its task ID for status queries with action.getBulkStatus(options).

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

Parent Object

action.Action

Sibling Object Members

Action Object Members

Since

2019.1

Parameters

Note:

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 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.params

array

required

The options.params parameter is mutually exclusive to options.condition and options.paramCallback.

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'} 

                  

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

the name of the function that takes a 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

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.

          // Add additional code
...
var actionObj = action.get({
         recordType: 'timebill', 
         id: 'approve'
});

var handle = actionObj.executeBulk({
    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

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

General Notices