2

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?

Benjamin
  • 429
  • 4
  • 17
  • I have actually been looking at this as well. I have a case open with NetSuite to find out how to perform this in 2.0. I'll post their answer, when I receive it. – w3bguy Aug 17 '16 at 12:16

2 Answers2

1

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

runtime.getCurrentScript().percentComplete

I could not find a way to set it.

prasun
  • 7,073
  • 9
  • 41
  • 59
  • According to Netsuite's docs, the field is get/set https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4296662993.html – Erick Smith Jan 07 '19 at 16:47
1

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;                               
      }
    }
  };
});
w3bguy
  • 2,215
  • 1
  • 19
  • 34