This little utility uploads your suitescript files to the NetSuite file cabinet from the command line or as a menu item or button in your IDE.
The idea is it's much faster than to fiddling with the netsuite UI to repeatedly upload a code file you're developing.
To install globally
npm install -g netsuite-sync
The commandline program is named
Get help with
This utility uploads files to a specific folder in your NetSuite file cabinet. We've found it a best practice to keep all suitescripts in a single folder if possible.
(Windows Users Note) We recommend you install Git Bash and run all this stuff in the bit bash shell.
Login to your NetSuite account and navigate to the folder you want to upload to - note the internal id of the folder.
Set a password as an in-memory environment variable - this is used to encrypt the generated config file
Generate a config file with the
Answer the prompts and supply the internal id of the destination folder you noted in step 1. This will generate both the encrypted and unencrypted NetSuiteConfig file.
Upload a file
ns -u SomeScriptFile.js
Confirm the file is there in NetSuite, then delete the plaintext NetSuiteConfig.js file.
Although generating a config with the
--gen-config option is the easiest way to go, you can do it more
manually with steps described in this section.
The following sets your password to 'foo'. Note you need to run this prior to running the utility. For an example of creating a script to launch WebStorm see here todo:add link
This tool uses SuiteTalk (NetSuite web services) to send files to the file cabinet. Hence it needs some configuration connection info stored locally. This connection info is stored in a file named NetSuiteConfig.js which is encrypted to NetSuiteConfig.js.enc
To generate a config file run with the
Answer the prompts. You can review the settings in the generated NetSuiteConfig.js file. Do remember to delete this file after you've confirmed it works (e.g. after you've successfully uploaded a file). Only NetSuiteConfig.js.enc is needed at runtime.
You can manually encrypt a NetSuiteConfig.js file with the
Fill out your plaintext NetSuiteConfig.js file, then encrypt it:
Then delete your plaintext NetSuiteConfig.js
If you ever need to check the config, use --decrypt-config:
To help setup a new config file:
ns -u filename
ns --upload filename
...pushes filename to the NS file cabinet under the folder specified in NetSuiteConfig.js
npm install to pull in all dependencies.
The webstorm regular node debug session doesn't seem to support interactive programs. So, launch the program in a separate terminal window like:
node --debug-brk=5858 ./ns.js
Then create a node remote debug session using this port and run it.
To just spew debug messages to the console, define an environment variable before launching like:
DEBUG=ns node ./ns.js
XML files under
/lib named <operation>Template.xml are SOAP snippets representing the NetSuite web service operation
For example, getTemplate.xml is the get operation as described in the NetSuite wsdl.