# NetSuite Governance Unit Calculator for SuiteScript

> Source: https://netray.co/tools/netsuite-governance-unit-calculator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Estimate how many governance units a script run uses and how many records fit in one execution before you hit the limit.

## Category

netsuite

## Erp

NetSuite

## Audience

- NetSuite developer
- SuiteScript developer
- Technical architect

## Tool

**Kind:** calculator

**Inputs:**

#### Governance limit for the script stage

**Key:** limit

**Type:** select

**Default:** 1000

**Options:**

##### 1,000 (user event, Suitelet, client, map stage)

**Value:** 1000

##### 5,000 (RESTlet, reduce stage)

**Value:** 5000

##### 10,000 (scheduled, map/reduce input and summarize)

**Value:** 10000

**Help:** Check the SuiteScript governance table for the exact limit of your script type and stage.

#### Records processed per run

**Key:** records

**Type:** number

**Default:** 200

**Min:** 0

**Step:** 10

**Unit:** records

#### record.load calls per record

**Key:** loads

**Type:** number

**Default:** 1

**Min:** 0

**Step:** 1

**Unit:** calls

#### Units per record.load

**Key:** load_cost

**Type:** number

**Default:** 10

**Min:** 0

**Step:** 1

**Unit:** units

**Help:** Varies by record type. Transactions cost more than custom records.

#### record.save calls per record

**Key:** saves

**Type:** number

**Default:** 1

**Min:** 0

**Step:** 1

**Unit:** calls

#### Units per record.save

**Key:** save_cost

**Type:** number

**Default:** 20

**Min:** 0

**Step:** 1

**Unit:** units

**Help:** Varies by record type. Verify in the governance table.

#### Fixed units per run (searches, lookups)

**Key:** fixed

**Type:** number

**Default:** 50

**Min:** 0

**Step:** 5

**Unit:** units

#### Safety buffer

**Key:** buffer

**Type:** slider

**Default:** 10

**Min:** 0

**Max:** 50

**Step:** 5

**Unit:** %

**Outputs:**

#### Units per record

**Key:** per_record

**Expr:** loads * load_cost + saves * save_cost

**Format:** integer

#### Estimated units for this run

**Key:** total

**Expr:** records * per_record + fixed

**Format:** integer

**Primary:** true

#### Usable units after buffer

**Key:** usable

**Expr:** limit * (1 - buffer / 100)

**Format:** integer

#### Max records per execution

**Key:** max_records

**Expr:** if(gt(per_record, 0), floor(max(0, usable - fixed) / per_record), 0)

**Format:** integer

**Primary:** true

**Description:** Reschedule or yield after this many records.

#### Share of limit used

**Key:** pct_used

**Expr:** if(gt(limit, 0), total / limit * 100, 0)

**Format:** percent

#### Executions needed for this volume

**Key:** runs

**Expr:** if(gt(max_records, 0), ceil(records / max_records), 0)

**Format:** integer

**Chart:**

#### Estimated units vs records processed

**Type:** line

**X:** records

**From:** 0

**To:** 600

**Steps:** 30

**Series:**

- total

**Disclaimer:** Unit costs depend on record type and API. Use the SuiteScript governance table in NetSuite Help for the exact values in your release, and confirm in a sandbox with runtime.getCurrentScript().getRemainingUsage().

## Content

**Intro:** Every SuiteScript API call that touches data costs governance units, and each script stage has a ceiling. This calculator shows how many units a planned run will use and how many records can be processed before the script must stop, yield or reschedule.

**Sections:**

#### How to use the calculator

**Body:** Choose the limit for your script type and stage, then enter the records per run, the number of loads and saves per record and the unit cost of each. Add a fixed amount for searches and lookups made once per run. The result shows total units, the share of the limit used and the maximum records per execution after your safety buffer. If the total exceeds the limit, split the work across stages or runs.

#### The formula

**Body:** Units per record are loads times load cost plus saves times save cost. Total units are records times units per record plus fixed units. Usable units are the limit reduced by the buffer, and the maximum records per execution is the usable units minus fixed units, divided by units per record and rounded down. Executions needed is the volume divided by that maximum, rounded up.

**Bullets:**

- Load and save costs differ by record type
- submitFields is usually cheaper than load and save
- Search pages and lookupFields have their own costs
- Keep a buffer for logging and error paths

#### Reading the result

**Body:** With the defaults, a record costs 30 units and the 1000 unit limit with a 10 percent buffer allows about 29 records. That is why a user event that rewrites many child records fails, while a map/reduce script, which resets usage for each map and reduce invocation, can process the same volume safely. If the maximum is small, redesign around submitFields, fewer loads or a map/reduce structure.

#### Common mistakes

**Body:** People often use one unit cost for every record type, forget that searches consume units per page, and assume governance resets between loop iterations. It does not. Another mistake is checking remaining usage only at the end. Check getRemainingUsage inside the loop and stop early, and test with production-sized data, since sandbox data volumes hide the problem.

**Cta:** If your NetSuite customizations are hitting governance limits, Netray can help review scripts and design batch patterns, with a human approving every change.

**Faq:**

#### What are governance units in NetSuite?

**Answer:** They are a metered cost for SuiteScript API calls such as loading, saving and searching records. Each script type and stage has a maximum per execution, and exceeding it throws an error that stops the script.

#### How do I check remaining usage?

**Answer:** Call runtime.getCurrentScript().getRemainingUsage() in SuiteScript 2.x and compare it with the cost of your next operation. Stop, yield or reschedule when it drops below a threshold you choose.

#### Why use map/reduce for big jobs?

**Answer:** Map/reduce splits work into many small invocations, each with its own governance allowance, and NetSuite manages queueing and retries. This avoids the single-run ceiling that scheduled scripts hit with large volumes.

#### Do the defaults in this calculator apply to every record?

**Answer:** No. They are placeholders. Costs differ by record type and API, so replace them with the values from the SuiteScript governance table for your release and confirm with a sandbox run.

## Search terms

netsuite governance units calculator, suitescript governance usage, netsuite script governance limits, suitescript remaining usage, netsuite record load governance cost, scheduled script 10000 units, suitescript governance units per record

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
