javascriptnetsuitesuitescript

Script Execution Instruction Count Exceeded error in Netsuite


I have a schedule script which does some calculation and update custom header field on a Sales Orders, which runs every 30 mins.

With the increase number of order's in Netsuite, I started receiving error saying "An unexpected error has occurred"

Execution Time: 677.15s Script Usage: 75 Error:SSS_INSTRUCTION_COUNT_EXCEEDED" Script Execution Instruction Count Exceeded. Stack Trace: scheduled

Please help me to get rid of this error.

p.s: no suite answer is available for the mentioned problem.


Solution

  • There is no proper documentation in NetSuite which tells the number of script lines that are allowed. As @rockstar said

    NetSuite has put internal mechanisms in place to detect “runaway scripts” that include infinite loops

    I faced the same error, even though there wasn't any infinite loop.

    The first approach you should take is try optimizing your scripts by reducing number of loops or unnecessary script statements.

    If that isn't possible or still doesn't help, you can probably yield your script after processing certain amount of data to reset the usage of script statements usage.