Benjamin
Benjamin

Reputation: 439

SuiteScript 2.0 - set scheduled percentage complete value

I am trying to convert a script that contains setPercentComplete from nlapiGetContext() function. That allows me to set the percentage complete value.

I am not seeing anything in regards to setting this for SuiteScript 2.0 has anyone discovered how to do that yet?

Upvotes: 2

Views: 1448

Answers (2)

w3bguy
w3bguy

Reputation: 2250

Below is the sample code that will work.

/**
 * @NApiVersion 2.x
 * @NScriptType ScheduledScript
 * @NModuleScope SameAccount
 */
define(['N/runtime','N/record'],function(runtime,record){
  return {
    execute:function(context){
      var script=runtime.getCurrentScript();
      for(x=0;x<500;x++){
        var rec=record.create({type:'salesorder'});
        script.percentComplete=(x*100)/500;                               
      }
    }
  };
});

Upvotes: 1

prasun
prasun

Reputation: 7343

runtime module's script object has got percentComplete as read-only property.

runtime.getCurrentScript().percentComplete

I could not find a way to set it.

Upvotes: 1

Related Questions