SuiteScript 2.x JSDoc Tags for JavaScript Documentation
SuiteScript 2.x JSDoc tags facilitate documenting JavaScript code, essential for effective script management in NetSuite.
SuiteScript 2.x introduces JSDoc tags, enabling JavaScript developers to document their code effectively. This documentation is crucial for maintaining scripts and enhancing code readability, especially when working within the NetSuite environment. JSDoc 3, a documentation generator, provides a structured way to include detailed comments in the source code, facilitating the generation of comprehensive documentation.
What is JSDoc?
JSDoc is a documentation generator specifically designed for JavaScript. Developers can insert specific comment blocks into their code, which start with /** and end with */. These blocks can include various JSDoc tags, prefixed by the @ symbol, to describe different entities in a JavaScript file—most notably, parameters, return values, and a variety of script configurations.
Example of a JSDoc comment block in SuiteScript:
1/**2 * Creates a file3 * @param {string} name - file name4 * @param {string} fileType - file type5 * @param {string} contents - file content6 * @returns {Object} file.File7 */Using JSDoc helps to ensure that scripts are well-documented, making it easier for other developers to understand and maintain them.
Key JSDoc Tags in SuiteScript 2.x
SuiteScript 2.x utilizes several essential JSDoc tags, two of which are mandatory for entry point scripts:
| JSDoc Tag | Description | Required/Optional |
|---|---|---|
@NApiVersion | Specifies the SuiteScript version to use: 2.0, 2.1, or 2.x. Required for entry points. | Required for entry point scripts |
@NScriptType | Identifies the type of script, for example, ClientScript, UserEventScript, etc. | Required for entry point scripts |
@NModuleScope | Controls the scope of access for scripts and modules, with values like Public and SameAccount. | Optional |
Understanding @NApiVersion
The @NApiVersion tag serves as a declaration for your scripts:
- For entry point scripts, it specifies which SuiteScript version to utilize.
- For custom modules, it can prevent compatibility issues between different versions.
It is important to note that 2.x typically indicates the latest suite version available, but this does not apply to 2.1. In this instance, 2.x refers to SuiteScript 2.0.
Understanding @NScriptType
This tag delineates the type of script being created. Some common values include:
ClientScriptUserEventScriptScheduledScript
Understanding the script type is vital for the appropriate deployment and functioning of the script within the NetSuite environment.
Conclusion
With the integration of JSDoc tags in SuiteScript 2.x, developers can enhance their scripting process through better documentation. This not only promotes clarity in coding but also aids collaboration and maintenance in the long term.
Key Takeaways
- SuiteScript 2.x uses JSDoc 3 for effective JavaScript documentation.
- Key tags include
@NApiVersionand@NScriptType, vital for entry point scripts. - Properly documented scripts improve maintainability and collaboration among developers.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What is the purpose of JSDoc tags in SuiteScript 2.x?
Are any JSDoc tags mandatory for SuiteScript 2.x entry point scripts?
What does the `@NApiVersion` tag specify in SuiteScript 2.x?
Why is the `@NScriptType` tag important in SuiteScript 2.x?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Custom Tool Script Enhancements in NetSuite
Custom tool scripts in NetSuite gain execution log support and a new management page in February 16, 2026.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
