Script.percentComplete

Property Description

The percent complete specified for the current scheduled script execution. This value appears in the % Complete column on the Scheduled Script Status page.

This value can be set or retrieved.

Type

number

Module

N/runtime Module

Since

2015.2

Errors

Error Code

Thrown If

SSS_OPERATION_UNAVAILABLE

The currently executing script is not a scheduled script.

Syntax
Important:

The following code samples show the syntax for this member. They are not a functional examples. For a complete script example, see N/runtime Module Script Samples.

          // Add additional code
...
// Gets the percentage of records completed
var scriptObj = runtime.getCurrentScript();
if (scriptObj.executionContext === ContextType.SCHEDULED) {
    log.debug({
        details: 'Script percent complete: ' + scriptObj.percentComplete
    });
}
...
// Add additional code 

        
          // Add additional code
...
// Sets the percent complete
var script = runtime.getCurrentScript();
for (x = 0; x < 500; x++) {
    var rec = record.create({
        type: record.Type.SALES_ORDER
    });
    script.percentComplete = (x * 100)/500;
    log.debug({
        title: 'New Sales Orders', 
        details: 'Record creation progress: ' + script.percentComplete + '%'
    });
}
...
// Add additional code 

        

Related Topics

General Notices