HOW TO OVERCOME GOVERNANCE LIMIT IN SCHEDULE SCRIPT?

HOW TO OVERCOME GOVERNANCE LIMIT IN SCHEDULE SCRIPT?

As a netsuite solution provider wewant to tell you Schedule script has a governance limit of 10000 units. In many situations, schedule script is used for processing huge amount of data and this might take more than 10000 units. To overcome this problem, Netsuite provides the api’s nlapiSetRecoveryPoint() and nlapiYieldScript(). This creates a recovery point and re-executes the schedule script from where it left and its governance units are also reset. It can create a recovery point even inside a for or while loop. nlapiSetRecoveryPoint() consumes 100 units. The below code explains how to use these api’s
if(nlapiGetContext().getRemainingUsage()<300)
{
 
                     nlapiSetRecoveryPoint();
                     nlapiYieldScript();
}
 
Put the above code at a point where it can check the remaining usage after each iteration of your code.

Log out of this account

Leave a Reply