I getting this error SSS_INSTRUCTION_COUNT_EXCEEDE...
# suitescript
a
I getting this error SSS_INSTRUCTION_COUNT_EXCEEDED. Any suggestion how to resolve this ?? Thanks
s
check your loops and processes within loops
it is a governance set by NetSuite
a
var buffer = []; var l = str.length; log.debug('Length',l); // length is 8977684 for (var i = 0; i < l; i++) { var char = str.charCodeAt(i) ^ 0x5A; buffer.push(String.fromCharCode(char)); }
s
depending on script type (UE, Scheduled, etc.), that maybe too much
a
I am calling a custom module from suitelet. From the above code what can we do to avoid the error please ?? Thanks
s
one of options below 1. Change the logic of the loop 2. Use another script type 3. Split script into multiple scripts
e
I have so many questions, but I will refrain. The short answer is "do less work". You're masking a 9 million character string, and that takes too many instructions according to NetSuite's governance system. The only way to not hit the limit is to process less data as I don't see any obvious ways to take logic out of your loop.
a
Thanks.
s
if you don't need the answer on real time, scheduled script might meet your requirement
👍 1
a
got it, i will try to move this logic to a schedule script. Thanks 👍
e
More appropriate would be a Map/Reduce; that is the "canonical" bulk processing script
✔️ 1
a
sure @erictgrubaugh. Thanks