SuiteScript naming conventions can prevent NetSuite from becoming messy and help you locate your scripts in NetSuite efficiently.
A Quick Blog Roadmap
If you have been following along with our SuiteScript blog, we’ve covered a lot of ground! We have learned about the common NetSuite script types, the most crucial SuiteScript modules, and how to create a Suitelet. Now’s the perfect time to transition to some very practical tips, guides, and suggestions for SuiteScripters in the real world. In the coming weeks, we will discuss things like how to organize your files for a SuiteScript project, using IDEs and SDF integration, recommended SuiteScript tools, and more.
Conventions
SuiteScript naming conventions are important. If they aren’t used, things can get very messy. When a client employs a developer to customize their NetSuite instance, they likely have had previous developers there before. As you look through the SuiteScript records page, you may be overwhelmed by the different script names. Various developer company initials are inked across page after page. "AI Automate Emails"
, "CD - UE Copy Invoice Field"
, "IQ - USER EVENT SUITELET THAT DOES COOL THINGS"
are just some fictional examples. To make things even more interesting, some clients will want their own company’s initials in the script names. For example, if you were developing a Client Script for Google, your script name may end up looking something like "GO Search for Info"
.
So why do scripts in NetSuite usually have names like these? Is it simply so we know who to blame when a script breaks? Partly. But it also can help you as a developer easily locate your own scripts in NetSuite. When there are dozens or even hundreds of scripts, having a clear naming convention is immensely helpful. At times you will need to locate a script that you wrote months ago for a client. Naming conventions will enable you to find that script quickly.
Suggested Practice
Perhaps it is best to demonstrate how we handle naming our scripts in a psuedo-coding fashion.
if (clientWantsTheirOwnCompanyNameOnScripts) {
// company = "NetSuite Company";
var NetSuiteScriptName = "NC Automate Emails"
} else {
// yourCompanyName = "SuiteRep";
var NetSuiteScriptName = "SR Automate Emails"
}
If your client requests that their company name be on all the scripts, then use their name in the title. Some clients choose this practice to provide a sense of coherence to the ecosystem. Locating particular scripts can be more difficult in this scenario however.
If your client does not have a preference to include their own company name in the scripts, we recommend that you include yours. This may actually provide more benefit to the client in the long-run since all developers will know exactly who created which script. Some developers choose to also include the script type in the title (e.g., SR UE Automate Emails
), but we recommend including this in your script file name rather than the script record or deployment record name. NetSuite already includes a way to natively filter script types.
When deciding on an internal ID for the script record or deployment, we recommend using the same name but translating it into snake-case (snake_case_looks_like_this). Don’t forget to add the extra underscore at the beginning so NetSuite can attach “custscript” to the name. In our example, we would call our internal ID "_sr_automate_emails"
for both our script record and our deployment record.
Naming Script Files
Speaking of naming script file names, we recommend the following pattern:
sr_automate_emails_ue.js
We include our company name, then the script title that summarizes the purpose, and then the type of script (User Event in this case). Of course, this is only a recommendation, and every developer may prefer something slightly different. Feel free to explore and discover what works best for you or for your development team.
Conclusion
Naming conventions for SuiteScripts can help maintain order in NetSuite. We recommend that you find what works best for you and settle on a particular way of naming your scripts. We hope you find this NetSuite development tip helpful! Do you have a different way that you prefer to name your scripts? Please comment down below and let us know! And don’t forget to subscribe to our mailing list for more helpful SuiteScript development blogs.
Hi folks, nice write up – all solid advice. I would suggest that in addition to a naming convention, I always suggest people make sure they carefully set the Script Owner. You mentioned using the script name so we know who to blame; having set an Owner for each script is useful for that too. You can see that when you view the Script and NetSuite will also send unexpected error emails to that person, by default. Cheers,
That’s really helpful. Thanks for the comment, Peter!