This project is meant to serve as a baseline template project for getting tests implemented easier in to your NetSuite projects. Use these stubs for modules which are imported to other NetSuite SuiteCloud projects.
Using the directory path /SuiteScript/...
, we can provide aliases locally for these modules while still being available in NetSuite -- as the root directory for SuiteScript files in NetSuite is /SuiteScripts/
.
This project pairs with the NetSuite-CustomModules-Template tutorial/template project.
- Open
./package.json
and customize the project configuration - Run
npm i
to install project dependencies - Add your module path aliases to
customJestStubs.js
- Create a local environment variable
NPM_TOKEN
using your NPM token for the value - Publish your npm package using
npm publish
README.hbs
-- Base template file the project README.md is generated fromnpmrc
-- NPM environment token loader file for publishing projectdocsMD.config
-- Wiki MD generator from JSDoc notationsjsDocsConf.json
-- JSDocs configuration file
Use npm run <script>
to execute various commands for the project
npm run docs
-- Generates project documentation based on JSDoc notations (Configure with docsMD.config && jsDocsConf.json)npm run open-docs
-- Opens documentation in browser for viewing
Azure yaml pipeline files are provided in .ci/workflows
.
azure-pipelines-docs.yml
-- Generates documentation, commits,and pushes back to current PR/branch
Your custom NetSuite module A
Summary: This is example stub of custom NetSuite module A. It may or may not be in your SuiteCloud project.
Update your jest.config.js
to map this module from the stub pkg to your local project if it is available.
See project jest.config.js
for further examples of this.
Format:
Napiversion: 2.1
Since: 2022.2
Version: 1.0.0
License: NApiVersion
- aModule
- aModule(query, log) ⏏
- .GetVendorPrefix(vendorId) ⇒
String
- .RunQuery(vendorId) ⇒
String
- .GetVendorPrefix(vendorId) ⇒
- aModule(query, log) ⏏
NetSuite module A export function
Kind: Exported function
Param | Type | Description |
---|---|---|
query | Object |
NS query module |
log | Object |
NS log module |
Returns preferred vendor prefix from record or blank if no prefix is located
Kind: static method of aModule
Param | Type | Description |
---|---|---|
vendorId | String |
Entity ID of vendor Ex: 4321 |
Returns query result of vendor prefix from vendor record
Kind: static method of aModule
Returns: String
- - Returns vendor prefix string from query result
Access: protected
Param | Type | Description |
---|---|---|
vendorId | String |
Vendor entity ID to run query on |
Your custom NetSuite module B
Format:
Napiversion: 2.1
Since: 2022.2
Version: 1.0.0
License: NApiVersion
- bModule
- bModule(log) ⏏
- .set_CustomFieldValue(options) ⇒
undefined
- .set_CustomFieldValue(options) ⇒
- bModule(log) ⏏
NetSuite module B export function
Kind: Exported function
Param | Type | Description |
---|---|---|
log | Object |
NS log module |
Example set custom body field value for record
Kind: static method of bModule
Param | Type | Description |
---|---|---|
options | Object |
Object of parameters for setting custom body field |
options.currentRecord | Record |
NS Record Object to update |
options.fieldId | String |
Field id on record object to update value on |
options.value | String |
Value to set record field to |
Happy Coding! 🥳