Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer peopleโ€™s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer peopleโ€™s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Home/ NetSuite Customization Guide: Fields, Forms, Workflows & Scripts/SuiteScript Governance and Usage Limits in NetSuite

SuiteScript Governance and Usage Limits in NetSuite

Introduction

NetSuite uses a SuiteScript governance model to manage system performance and prevent scripts from consuming excessive resources. Each script type and SuiteScript API consumes a specific number of usage units. Once the script exceeds its allowed units, execution is terminated automatically to protect the system.

If youโ€™ve ever faced the SSS_USAGE_LIMIT_EXCEEDED error, itโ€™s likely your script hit one of these thresholds.


How SuiteScript Governance Works

SuiteScript usage is tracked in two ways:

  1. By Script Type โ€“ Each type (User Event, Client, Scheduled, Map/Reduce, etc.) has its own time and resource limits.
  2. By API Call โ€“ Each SuiteScript API method consumes a fixed number of usage units (for example, loading a record uses more than reading a field).

When limits are exceeded, NetSuite automatically stops script execution to prevent performance degradation.


Map/Reduce Script Data Size Limits

Map/Reduce scripts are designed for large-scale data processing, but they also have strict limits on data size:

ConstraintLimitError Code
Maximum Key Length3,000 charactersKEY_LENGTH_IS_OVER_3000_BYTES
Maximum Value Size10 MBVALUE_LENGTH_IS_OVER_10_MB

Tip:
When using mapContext.write() or reduceContext.write(), keep keys under 3,000 characters and values under 10 MB. Avoid using keys to pass dynamic or long strings โ€” use values instead.


Common SuiteScript API Governance Units

Below is a reference table of typical governance unit consumption by SuiteScript 2.x APIs.
(Values are approximate and may vary slightly depending on NetSuite release updates.)

SuiteScript API / ActionModuleTypical Governance Units
record.load()N/record10
record.save()N/record20
record.submitFields()N/record5
record.delete()N/record20
record.copy()N/record10
search.create()N/search5
search.run()N/search5
search.lookupFields()N/search10
search.load()N/search5
email.send()N/email10
file.load()N/file5
file.create()N/file10
http.get()N/https10
http.post()N/https10
record.attach()N/record10
record.detach()N/record10
record.getValue()N/record0
record.setValue()N/record0
runtime.getCurrentUser()N/runtime0
task.create()N/task5
task.submit()N/task10
format.format()N/format0
log.debug()N/log0

These numbers help developers design scripts that stay well within usage limits โ€” particularly important for Scheduled or Map/Reduce scripts handling large data sets.


Script Type Usage Limits (Approximate)

Script TypeGovernance Limit (Units)Execution Time Limit
User Event1,00010 minutes
Client Script1,000User-controlled
Scheduled Script10,00060 minutes
Map/Reduce (per stage)5,000Managed by NetSuite
RESTlet5,0005 minutes
Suitelet1,00010 minutes
Portlet1,00010 minutes
Workflow Action Script1,00010 minutes

Note: When a script exceeds its time or usage threshold, it automatically reschedules (for Map/Reduce) or stops execution.


Error Handling and Governance Enforcement

NetSuite internally detects scripts that might run endlessly or execute excessive loops.
If detected, it throws the error:

SSS_INSTRUCTION_COUNT_EXCEEDED
Indicates a potential infinite loop or unending recursion.

To prevent this:

  • Always include loop exit conditions.
  • Limit recursion and nested logic.
  • Avoid unnecessary while loops without termination logic.

Monitoring Script Usage

You can check remaining usage units in your script with:

const runtime = require('N/runtime');
log.debug('Remaining Usage:', runtime.getCurrentScript().getRemainingUsage());

This is especially useful to decide when to reschedule a script or yield control before hitting limits.


Best Practices to Prevent Governance Issues

โœ… Batch Processing: Process records in small chunks (for example, 500 per batch).
โœ… Avoid Redundant Loads: Only load records when necessary.
โœ… Optimize Searches: Use filters, columns, and saved searches instead of large unscripted searches.
โœ… Cache Data: Use N/cache module or temporary variables.
โœ… Monitor Logs: Avoid excessive logging that consumes script time.
โœ… Use Map/Reduce for Heavy Jobs: They auto-handle concurrency and rescheduling.


Key Takeaway

SuiteScript governance is NetSuiteโ€™s way of balancing performance and stability across accounts.
By understanding usage units, optimizing API calls, and writing efficient scripts, youโ€™ll:

  • Avoid timeouts and governance errors.
  • Improve overall script performance.
  • Keep your integrations and automations running smoothly.

Related Resources

  • SuiteScript 2.x API Governance (Oracle Documentation)
  • NetSuite Script Type Usage Unit Limits
  • SuiteScript 2.x Modules Overview
Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuiteโ€™s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 22 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Menu

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us

Quick Links

  • NetSuite Scripting
  • NetSuite Customization
  • NetSuite Advanced PDF Template
  • NetSuite Integration
  • NetSuite Reporting & Analytics

Subscribe for NetSuite Insights....

© 2025 The NetSuite Pro. All Rights Reserved