In today’s heated political climate, the talking of politics is a touchy subject. In most cases its best avoided since everyone has their own opinion. In the land of NetSuite customization, we can talk all the politics we want. Writing scripts in a cloud-based system forces us to obey the governor’s rules. You face a severe penalty for exceeding his limits. He imposes the dreaded SSS_USAGE_LIMIT_EXCEEDED or one of his many other taxes to keep errant developers under wraps.
Since the release of 2018.2 this error seems to occur quite frequently. Governor Nance has been cracking down on the tax evaders whose suitescripts that throw such errors. The fictitious Governor I speak of is NetSuite’s rules of governance for suitescripts. Rules of suitescript dictate each script must be carefully coded to avoid exceeding predefined limits. The limit for scheduled scripts is 10,000 units. When a scheduled script hits this limit, best practice dictates you should call a statement call nlapiYieldScript. The purpose is to restart the script with the usage counter reset.
While being a best practice, this method has not been reliable for me lately. My scripts have been hitting the limit throwing a usage limit exceeded. In one case I got an error NLAPISETRECOVERYPOINT_MUST_BE_CALLED_FROM_A_SCHEDULED_SCRIPT which is completely inaccurate because the error is thrown in a scheduled script. After going thru the usual support diagnostics with Netsuite I was told a defect would be filed and the severity was blah blah blah. Clink, the sound of another defect coin going into the governor’s coffers.
In this case the script was mission critical. I needed to get my script to work so I decided if the yield wasn’t going to work I would write my own. I started by removing the offending code containing the line that yielded the script. Now the only thing left to do is overcome Governor Nance’s tax laws by getting my script to run even though I was exceeding his 10,000-unit limit. I accomplished this by adding my own call to the scheduler using nlapiScheduleScript. Now when the remaining usage is below the defined threshold script properly exits and start itself over.
Since I did this, the script has run without issue and our scheduled scripts run without paying the taxes to the Governor. Who said you cant talk politics? In this case a little tax evasion was all we needed to overcome an unexplained error that almost stopped a mission critical app.