
NetSuite SuiteScript allows developers to customize NetSuite in a number of ways and empowers them to fulfill complex requirements of customers that cannot be met by out-of-the-box NetSuite.
With such a powerful tool in hand, it is important for developers to follow certain best practices while performing customizations so as not to impact the NetSuite accounts that they are working on.
This guide covers the key aspects of SuiteScript that are critical for building efficient and scalable customizations, including:
Learn NetSuite SuiteScript best practices, script limits, and governance tips to optimize performance, avoid errors, and build scalable customizations.
The first and most important concept is governance limits NetSuite offers There are 10 different script types offered by NetSuite which allow developers to perform customizations on both the client side and server side, and each with a of them has a pre-defined governance limit. These script types allow developers to perform customizations on both the client side and server side.
Exceeding these limits results in:
Why this matters
For NetSuite accounts with heavy customization:
NetSuite provides 10 different script types. Each SuiteScript type whether it’s Client Script, User Event Script, Map/Reduce, or RESTlet- serves a distinct purpose depending on the use case, data volume, and execution context. To get a deeper understanding of when and how to use each script type effectively, explore our detailed guide on NetSuite SuiteScript Types.
Client scripts are used to handle the client-side functionality while all the other remaining scripts are server-side scripts and are used to handle backend functionality. Client script and User event script types get triggered based on the user’s actions performed on the UI.
Behind the scenes, certain server-side scripts could be triggered indirectly through the user event script.
However, primarily Client and User Event Script only these two script are the two types are executed by the user’s actions on a record in NetSuite.
As per NetSuite developer documentation, there is no limit to the number of user event scripts that can be executed on a particular record-type. For example, we can deploy 10 beforeLoad, 9 beforeSubmit, and 15 afterSubmit executing functions on a record which supports that specific script type. But NetSuite recommends not exceeding 10 scripts of the same trigger type to maintain performance.
In case of client scripts, there is a limit of 10 scripts per record. NetSuite executes only the first 10 deployed scripts, taking performance into consideration.
Developers who include scripts in their bundles should also be aware of the number of user events scripts that might have already been deployed to the different record types in the target NetSuite account, and work with the client closely to determine a strategy and design that will work for their NetSuite account.
For example, if 8 beforeSubmit user event scripts are already deployed to the Sales Order record in the client NetSuite account, and your bundle includes another 7 beforeSubmit user event scripts on the same record type, the total number is 15 beforeSubmit scripts. All these scripts will run every time a user clicks Save on the Sales Order record. With all these scripts running on save, the time it takes for the record to save may be significantly increased, again, negatively affecting user experience.
Deploying a higher number of client scripts may create a delay in manipulating data on the record when the user is editing the record. If the number of client scripts that are deployed on a record exceeds the count of ten, the most recent scripts which are deployed will be prioritized lower on the scripted records page and may or may not be executed.
Tvarana is an Oracle NetSuite SDN partner and award-winning firm. Our development team holds SuiteCloud Developer certifications and has delivered SuiteScript customizations across manufacturing, distribution, and professional services organizations globally.
To learn more about areas where you can improve the performance of your scripts, schedule a consultation with our team of NetSuite experts today.