NETSUITE GOVERNANCE
To optimize NetSuite application performance, NetSuite uses a SuiteScript governance model based on usage units. If the number of allowable usage units is exceeded, the script execution is terminated.
Usage units are tracked on two levels:
- Script type level
- API level
The following table lists the maximum allowable usage units for each SuiteScript (1.0 and 2.x) script type. You can use the Script.getRemainingUsage() method to see how many usage units you have remaining for a particular script.
Script Type | Usage Limit |
Client | 1,000 |
User Event | 1,000 |
Suitelet | 1,000 |
Portlet | 1,000 |
Workflow Action | 1,000 |
RESTlet | 5,000 |
Scheduled | 10,000 |
Map/Reduce | 10,000 |
Bundle Installation | 10,000 |
Mass Update | 10,000 per record |
The governance model takes into account the NetSuite processing requirements for three categories of records: custom records, standard transaction records, and standard non-transaction records. For example, custom records require less processing than standard records, therefore, the usage unit cost for custom records is lower than for standard records. Similarly, standard non-transaction records require less processing than standard transaction records, therefore, the usage unit cost for standard non-transaction records is lower than for standard transaction records.
If a script exceeds its API usage limit, NetSuite terminates the script by throwing an SSS_USAGE_LIMIT_EXCEEDED error.
Below are a few examples of unit costs for common operations. For an exhaustive list of Governance costs, see the article titled “API Governance” in NetSuite Help.
Operation | Unit Cost |
Loading a Saved Search | 5 |
Retrieving Search Results | 10 |
Scheduling a task | 10 |
Requesting a URL | 10 |
Sending an email | 10 |
Creating a custom record | 2 |
Creating an Employee record | 5 |
Creating a Sales Order record | 10 |
Saving a custom record | 4 |
Saving a Contact record | 10 |
Saving a Purchase Order record | 20 |
Deleting a Purchase Order record | 20 |
API Governance Examples
The following examples show how governance units are calculated in a user event script and in a scheduled script:
Script Description | Usage Units Calculated |
A user event script on a standard transaction record type (such as invoice) that includes:
|
This script uses a total of 40 usage units:
Each user event script can use a maximum of 1,000 usage units, so in this case, this script has plenty of room to be expanded. |
Additional Resources