Netsuite Script Usage Limits and How to deal with that?

Hi All,

Today we are going to learn about usage and its limit.In Netsuite , processing large data or making report some times throw limit exceed error.
**** Suite Script 2.0 api's usage will be updated soon.
Don't forget to join our FB Group, Like our FB Page

To read our blog anytime use our Android APP. You can find jobs , referrals and freelancing jobs also. 
To download Netsuite Guru App click .

What is Usage? 

In Netsuite , there are records, custom records, list , etc which are object and has some worth to load that object or say get value of that particular object.
Now there are many operations likes nlapiLoadRecord, nlapiSearchRecord etc etc in Netsuite which cost some value, 
Consider it as single penny as one Usage , every operation required some penny as cost.

For Example ,

nlapiSearchRecord operation cost 10 units usage, 
and
nlapiLoadRecord cost 10 for standard transaction records, 5 for non transaction standard
record and 2 unit when used for custom record.

Now Lets say below script has 10 record then calculate total number of usage script 
will need?
function executeSearch() { var rec = ''; var searchresults = nlapiSearchRecord( 'customer', null, null, null );//10 units
 if(searchresults)
{
for ( var i = 0; i < searchresults.length; i++) { var record = nlapiLoadRecord(searchresults[i].getRecordType(), searchresults[i].getId() );//10*5=50 units rec = rec + record.getRecordType() ; rec = rec + ' -Record ID = ' + record.getId(); }
}
 nlapiSendEmail(111, 111, 'customerRecordLoaded', rec, null); // 10 units }

Answer:
70 Units

How to Calculate Usage?

To calculate we have to see  operations and on which objects transactions, non transactions or custom records.
Below is the list : 


API Name

Units
Record Type
nlapiDeleteFile

20
ALL
nlapiInitiateWorkflow
20
AL
nlapiScheduleScript
20
ALL
nlapiTriggerWorkflow
20
ALL

nlapiSubmitConfiguration
20
All
nlapiSubmitFile
20
All
nlobjEmailMerger.merge()
20
All



 nlapiDeleteRecord - 20 on transaction , 10 on non transaction and 4 on custom record.
nlapiSubmitRecord - 20 on transaction , 10 on non transaction and 4 on custom record 


nlapiAttachRecord
10
All
nlapiDetachRecord
10
All
nlapiExchangeRate
10
All
nlapiGetLogin
10
All
nlapiLoadConfiguration
10
All
nlapiLoadFile
10
All
nlapiMergeRecord
10
All
nlapiRequestURL
10
All
nlapiRequestURLWithCredentials
10
All
nlapiSearchGlobal
10
All
nlapiSearchRecord
10
All
nlapiSendCampaignEmail
10
All
nlapiSendEmail
10
All
nlapiVoidTransaction
10
All
nlapiXMLToPDF
10
All

10
All
nlobjSearchResultSet.getResults
10
All
nlobjSearchResultSet.forEachResult
10
All
nlapiAttachRecord
10
All
nlapiDetachRecord
10
All
nlapiExchangeRate
10
All
nlapiGetLogin
10
All
nlapiLoadConfiguration
10
All
nlapiLoadFile
10
All
nlapiMergeRecord
10
All
nlapiRequestURL
10
All
nlapiRequestURLWithCredentials
10
All
nlapiSearchGlobal
10
All
nlapiSearchRecord
10
All
nlapiSendCampaignEmail
10
All
nlapiSendEmail
10
All
nlapiVoidTransaction
10
All
nlapiXMLToPDF
10
All

10
All
nlobjSearchResultSet.getResults
10
All
nlobjSearchResultSet.forEachResult
10
All




nlapiCreateRecord
10,5,2
Transaction, Non Transaction, Custom
nlapiCopyRecord
10,5,2
Transaction, Non Transaction, Custom
nlapiLookupField
10,5,2
Transaction, Non Transaction, Custom
nlapiLoadRecord
10,5,2
Transaction, Non Transaction, Custom
nlapiSubmitField
10,5,2
Transaction, Non Transaction, Custom
nlapiTransformRecord
10,5,2
Transaction, Non Transaction, Custom



nlapiLoadSearch
5
ALL
nlobjJobManager.getFuture
5
ALL
nlobjSearch.saveSearch
5
ALL



nlapiSetRecoveryPoint
100
All
nlapiSubmitCSVImport
100
All
nlobjJobManager.submit
100
All






 Also Scripts are allowed to use certain usage only, so lets say we gave some penny to every scripts, every scripts should only spend the maximum possible penny/usage.

1. Schedule Script: 10,000 Units
2. User Event Script: 1,000 Units.
3. Client Script: 1,000 Units
4. Suitelet: 1,000 Units
5.Restlet: 5,000 Units
6.Portlet Scripts : 1,000
7. Mass Update Scripts: 1,000 units per record.

8. Bundle Installation Scripts: 10,000 units
9. Workflow Action Scripts - 1,000 units

Now if we are writing User Event then we have to write our code and keep usage below 1,000 units.
If we are writing Schedule Script then we have to write a code to keep usage below 5000 units.
So units and usage depends on Script and what operation we are doing, searching record , updating record etc.



Thanks
Abhishek




Comments

  1. How to increase governance limits in restlets. Any solutions or any api which I have to use.

    ReplyDelete
    Replies
    1. Hi Deepa,
      You can not increase governance limit of restlet but you can use suitelet as supporting script and move some of your logic there and send response back to restlet , process next logic and return response.
      This might be comfusing but if you have notice calling nlapiRequestURL only take 10unit but you will get rid of all your complex usage(keep suitelet limit of 1K in mind).
      I will write a post on that , you can follow me on linked in
      www.linkedin.com/in/netsuiteguru
      also you can download android app.
      https://play.google.com/store/apps/details?id=com.blogspot.netsuiteguru

      We are adding more things to app so will help you for sure and you can even contribute as expert in future.

      Delete

Post a Comment

Thanks for you message, please join us on Facebook and Linkedin