Modules
Objects/Functions
SuiteScript 2.0
{Script}.percentComplete{SSS_OPERATION_UNAVAILABLE: {}})
N/runtime Module
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
Supported Script Types:
Client and server scripts
For more information, see SuiteScript 2.0 Script Types.
Module:
N/runtime Module
Since:
2015.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=Script.percentComplete
Example:
// Code Example 1
// 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
// Code Example 2
// 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
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4296662993.html