.toc-list { position: relative; } .toc-list { overflow: hidden; liststyle: none; } .gh-toc .is-active-link::before { background-color: var(–ghost-accent-color); /* Sets the TOC accent color based on the accent color set in Ghost Admin */ } .gl-toc__header { align-items: center; color: var(–foreground); cursor: pointer; screen: flexible; gap: 2rem; justify content: space between; filling: 1rem; width: 100%; } .gh-toc-title { font-size: 15px !important; font weight: 600! Important; letter spacing: .0075rem; line-height: 1.2; margin: 0; texttransformation: uppercase; } .gl-toc__icon { transition: transform .2s ease of input and output; } .gh-toc li { color: #404040; font-size: 14px; line-height: 1.3; bottom margin: .75rem; } .gh-toc { display: none; } .gh-toc.active { show: block; } .gl-toc__icon svg{ transition: transform 0.2s easy in and out; } .gh-toc.active + .gl-toc__header .gl-toc__icon .rotated{ transform: rotate(180 degrees); } .gl-toc__icon .rotated{ transform: rotate(180 degrees); } .gh-toc-container-sidebar{ display: none; } .gh-toc-container-content{ display: block; width: 100%; } a.toc-link{ background-image: none! Important; } .gh-toc-container-content .toc-list-item{ margin-left: 0 !important; } .gh-toc-container-content .toc-list-item::marker{ content: none; } .gh-toc-container-content .toc-list{ padding: 0 !important; margin: 0 !important; } Display only @media and (min-width: 1200px) { .gh-sidebar-wrapper{ margin: 0; position: sticky; up: 6rem; left: calc((( 100vw – 928px)/ 2 ) – 16.25rem – 60px); z-index: 3; } .gh-sidebar { align-self: flex-start; background color: transparent; flexible steering: column; gridarea: knock; maximum height: calc(100vh – 6rem); width: 16.25 rem; z-index: 3; position: sticky; top: 80px; } .gh-sidebar:before { -webkit-backdrop-filter: blur(30px); backgroundfilter:blur(30px); background-color:hsla(0, 0%, 100%, .5); edge radius: .5rem; content: “”; show: block; height: 100%; left: 0; position: absolute; top: 0; width: 100%; z-index: -1; } .gl-toc__header { cursor: default; flexible shrinkage: 0; pointerevents: none; } .gl-toc__icon { display: none; } .gh-toc { show: block; flex: 1; overflow-y: auto; } .gh-toc-container-sidebar{ display: block; } .gh-toc-container-content{ display: none; } } ))>
NetSuite's flexibility comes from its powerful customization tools, and SuiteScript is at the core of this. If you're looking to break free from the limitations of pre-established workflows, SuiteScript offers a way to transform NetSuite into a system that works with your unique processes and ambitions.
In this guide, I'll discuss the capabilities of SuiteScript, explain how to create your first script, and share best practices to help you unlock the full potential of NetSuite.
What is SuiteScript?
SuiteScript is NetSuite's JavaScript-based programming language, allowing developers (By the end of this article, that will be you too!) to create custom solutions that perfectly align with complex business needs.
From automating manual tasks to running complicated workflows, SuiteScript allows you to set up automations for simple tasks that need to run whenever certain conditions are met.
For example, you can set up a SuiteScript to automatically report inventory levels in your warehouse every day and create an alert if there is a stockout of any SKU.
Ultimately, with SuiteScripts, you can automate many operations around processes such as:
How does SuiteScript work?
At its core, SuiteScript works by responding to specific triggers (called events) within NetSuite. These triggers can range from user interactions to scheduled events, allowing scripts to respond in real time or run at set intervals.
Real world applications:
Automatically notify a supplier when inventory levels fall below a threshold.
Schedule nightly tasks to reconcile data between departments.
Validate input fields in forms to maintain data integrity.
Some other practical use cases
1. Automation of approval workflows
Optimize multi-level approvals for purchase orders or invoices by triggering custom scripts based on thresholds or approver roles.
2. Custom reports
Develop dashboards that consolidate and visualize data across subsidiaries, providing executives with actionable insights in real time.
3. Integrations
Synchronize data between NetSuite and third-party applications such as Salesforce, Shopify, Magento or any other CRM or e-commerce platforms or logistics providers.
Read on to learn how you can configure something like this for your NetSuite deployment.
Writing your first SuiteScript
Do you want to try your luck with SuiteScript? Let's start simple: creating a script that displays a friendly message when opening a customer record.
Step 1 – Enable SuiteScript
Before diving into the code, make sure SuiteScript is enabled:
- Navigate to Settings > Company > Enable Features.
- under the SuiteCloud tab, enable Client SuiteScript and accept the terms.
- Click Save.
Step 2: write the script
Create a JavaScript file (welcomeMessage.js
) containing the following code (you can copy the text below):
javascriptCopy codedefine((), function(
) { function pageInit(context
) { alert('Welcome to the Customer Record!'
);
} return { pageInit
: top of page };
});
Step 3: Upload the script
- Gonna Documents > Files > SuiteScripts.
- upload your
welcomeMessage.js
file in the SuiteScripts folder.
Step 4: Deploy the script
- Navigate to Personalization > Scripting > Scripts > New.
- Select your uploaded script and create a deployment record.
- Set it to apply to Customer registration and save.
Step 5: Try it!
Open any customer record in NetSuite. If deployed successfully, a greeting will appear confirming that your script is active.
Write advanced suite scripts
Now, let's move on to writing something that you can actually use in your daily work with NetSuite.
As an example, let's solve this problem:
You want to automatically notify your sales team when inventory levels for any SKU drop below a certain threshold, so they can create accurate sales quotes.
This is how you can analyze the problem:
Step 1 – Identify your requirements
- Limit: Determine the inventory threshold for each item.
- Notification method: Decide how your sales team will be notified (for example, email or NetSuite notification).
- Trigger: Define when the script should run (for example, when updating item inventory or on a fixed schedule).
Step 2: Configure the script in NetSuite
- Sign in to NetSuite: Gonna
Customization > Scripting > Scripts > New
. - Script type: Choose the appropriate script type (for example, scheduled script or user event script).
- Deployment: Configure the script deployment for the items or schedule it to run periodically.
Step 3: Code the script
Here is the SuiteScript code for a programmed script to check inventory levels and notify the sales team via email:
This SuiteScript does the following 3 things:
- Create a search function for inventory items.
- Run the threshold check on each item in that search.
- Notify the sales team for each item that is below the threshold.
Taking SuiteScript to production
SuiteScript offers a rich set of tools to create more complex and robust solutions, which can really add value in your NetSuite production environment.
1. Event-based logic
SuiteScript supports user event scripts, client scripts, and scheduled scripts to execute actions precisely when needed. You can trigger actions on any event, whether it's a data change in NetSuite or a regular interval like 8am every day.
2. Comprehensive APIs
Developers can leverage APIs to connect NetSuite with external platforms such as payment gateways or CRM systems. This allows you to extend the capabilities of NetSuite, outside of the core ERP.
3. SuiteScript Development Framework (SDF)
For large projects, SDF provides advanced tools for developers. It introduces things like version control (you may be familiar with this if you use BitBucket or GitHub) and deployment automation, along with project management.
Best Practices for SuiteScript Development
1. Keep it modular
Break your scripts into reusable functions or modules for easy debugging and maintenance. If you've ever worked with functions in programming, this is pretty similar: a script should do exactly one thing and nothing more.
2. Monitor the limits of governance
NetSuite applies governance rules to prevent excessive use of system resources and usage units. Use methods like runtime.getCurrentScript().getRemainingUsage()
stay within limits.
3. Extensive testing
Always test scripts in a sandbox environment before deploying them to production. Unit and integration tests are essential. If you're not sure whether you should deploy a script to your production environment, ask your internal teams to test it in the staging environment first.
4. Document everything
Good documentation reduces onboarding time for new developers and prevents misunderstanding the purpose of your code.
SuiteScript 2.x vs 1.0: Which Should You Use?
SuiteScript 2.x is the modern standard, offering modular architecture and enhanced API capabilities, while SuiteScript 1.0 serves legacy use cases.
Feature | SuiteScript 1.0 | SuiteScript 2.x |
---|---|---|
Architecture | Monolithic | Modular |
Dependency management | Manual | Automatic |
Coding style | Functional | Object-oriented |
API coverage | Essential | Comprehensive |
Unleashing the full potential of NetSuite and SuiteScript
While SuiteScript is powerful, the integration of ai workflow automation platforms like Nanonets elevates its functionality. Nanonets automates repetitive processes, validates data with unmatched accuracy, and delivers intelligent insights, all seamlessly integrated into NetSuite. From AP workflows to financial analytics, Nanonets enhances every layer of automation.
Getting started with nanogrids can be as easy as connecting for 15 minutes with an automation expert. Set up a time of your choosing using the link below.