task.RecordActionTaskStatus

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

Encapsulates the status of a record action task.

Supported Script Types

Server scripts

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

Module

N/task Module

Methods and Properties

RecordActionTaskStatus Object Members

Since

2019.1

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/task Module Script Samples.

          //Add additional code ... 
var recordActionTask = task.create({
    taskType: task.TaskType.RECORD_ACTION
});
recordActionTask.recordType = 'timebill';
recordActionTask.action = 'approve';
recordActionTask.params = [{recordId: 1}, {recordId: 5}, {recordId: 23}];
var handle = recordActionTask.submit(); // Add any additional processing here
var taskStatus = task.checkStatus({taskId: handle}); // returns a RecordActionTaskStatus object log.debug('Initial status: ' + taskStatus.status);
...
//Add additional code

/* Example contents of a RecordActionTaskStatus object at different stages of bulk action task execution: 
// initial status immediately after submitting the task 
{ status: 'PENDING', results: {}, errors: {}, complete: 0, succeeded: 0, failed: 0, pending: 3
}
// in the middle of processing, two records processed, one to go
{ status: 'PROCESSING', results: { 1: { response: { approvedId: 1 }, notifications: [] }, 5: { response: { approvedId: 5 }, notifications: [{ title: 'Title', message: 'Message', severity: { value: 2, label: 'Warning' }}] } }, errors: {}, complete: 2, succeeded: 2, failed: 0, pending: 1
}
// complete, all successful
{ status: 'COMPLETE', results: { 1: { response: { approvedId: 1 }, notifications: [] }, 5: { response: { approvedId: 5 }, notifications: [{ title: 'Title', message: 'Message', severity: { value: 2, label: 'Warning' }}] }, 23: { response: { approvedId: 23 }, notifications: [] } }, errors: {}, complete: 3, succeeded: 3, failed: 0, pending: 0
}
// complete, one action returned an error
{ status: 'COMPLETE', results: { 1: { response: { approvedId: 1 }, notifications: [] }, 5: { response: { approvedId: 5 }, notifications: [{ title: 'Title', message: 'Message', severity: { value: 2, label: 'Warning' }}] } }, errors: { 23: { name: 'SSS_RECORD_DOES_NOT_SATISFY_CONDITION', message: ... } }, complete: 3, succeeded: 2, failed: 1, pending: 0
}
*/ ...
//Add additional code 

        

Related Topics

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

General Notices