There is some setup required if you want to cling to your Microsoft roots and stick with a Microsoft Editor when writing NetSuite code in the cloud.
I’ve been using Visual Studio for a long (long) time! I like it. Several years ago when I attended the Visual Studio Live conference in Redmond, I asked one of the VS developers how big their team was. I’ll remind you, this was several years ago. She said it was right at 110 teammates.
I haven’t been back to Redmond in a few years. Instead, I’ve been attending SuiteWorld. So I can’t say how big the VSCode team is. But the product is good and getting better fast. I get updates several times per month.
So… If you come from a Microsoft background, like me, or you are ready to try an alternative to Eclipse, here’s how you can use VSCode seamlessly in the NetSuite developer realm.
My How-To:
- Install VSCode – https://code.visualstudio.com/download
- Install NetSuite-Sync : npm install – g netsuite-sync
- Create a config file: ns -g
- This prompts you for user ID & password
- Then it prompts for a NetSuite folder ID
- Then it creates a NetsuiteConfig.js file with all your info unencrypted
- Next install “Git for Windows” – https://git-for-windows.github.io
- Open the Git Bash command prompt
- CD to the folder where you created your NetsuiteConfig.js file.
- Type: export NSPW=”some encryption seed”
- Then encrypt your NetsuiteConfig.js file by typing: ns -e
- Then delete your NetsuiteConfig.js file, since you’ll be using the encrypted version.
- In VSCode [ctrl] + ` or … View >> Terminal
- In the terminal window, type:
ns -u {some javascript file name in the same directory} - The file you just named will be uploaded to the folder you specified in your original NetsuiteConfig.js file.
Here is a shortcut that I found very useful. You’ll want it too.
- Let’s set VSCode to auto-save. File >> Preferences >> Settings
- Type in “auto save” to find the following:
- These are my auto-save settings. Feel free to make yours look like mine.
- In VSCode’s editor window, hit F1 to open the command center.
- Type: shortcuts
- select the highlighted option (in yellow)
- Add the following key binding:
- Once you make this change, you can simply hit [ctrl] + [alt] + u to upload the current file to NetSuite.
I’ve found this works really well. I’m certainly open to suggestions if you’ve got any. Please leave me a comment if you can improve on this, or if you hate it and Eclipse is way better. For us Microsoft devs… this is quite familiar. Lovin’ it!
Great delivery. Solid arguments. Keep up the amazing work.
LikeLike
[…] I chose VSCode instead of Eclipse as my IDE for SuiteScript development. I have another article on using VSCode + NetSuite-Sync to publish SuiteScript to the cloud. In that article, I failed to mention how to make VSCode aware […]
LikeLike
[…] Note: Here is my original article regarding VSCode & NetSuite-Sync […]
LikeLike
Is it tied up with SDF? I am thinking if we integrate SDF that would be so much better. 🙂
LikeLike
I am not aware of any plugins that integrate SDF. Microsoft, if you’re listening… that would be fantastic!
LikeLike
[…] https://followingnetsuite.com/2019/03/14/vscode-netsuite-lovin-it/ […]
LikeLike
struck at #5
LikeLike
This is the internal ID of the folder where you wish to upload files to.
LikeLike
at step 10, I got the error “passphrase must be specified or set as NSPW environment variable”.
Any idea what might cause it??
Thanks.
Anh
LikeLike
I believe you can do this step in VS Code now in the terminal window. Perhaps you could try that. Literally, all you are doing is setting a windows environment variable (as I recall).
LikeLike
What is “some encryption seed”
LikeLike
Any random text of your choice.
LikeLike
Does this actually work?
I get a number of errors when trying to connect with a sandbox.
For example:
Sandbox Account? [y/n]: y
{
error: Error: getaddrinfo ENOTFOUND rest.sandbox.netsuite.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
errno: ‘ENOTFOUND’,
code: ‘ENOTFOUND’,
syscall: ‘getaddrinfo’,
hostname: ‘rest.sandbox.netsuite.com’
},
response: undefined
}
LikeLike
I’m pretty sure I addressed this in another post on connecting with sandbox, or perhaps an addendum. Not sure. Having said that, the rule (at least for me) is never ever ever say “y” to “Sandbox Account?” I’ve never gotten that to work. Always say “n” and then supply a user account associated with sandbox. In my case, I’m always presented with “Administrator (SB1)”. Pick that one. Another gotcha is when you create a Release Preview account. When that exists, I’ve found that I can’t use “Administrator” any longer. I need an account that is not present in RP. Otherwise there is confusion. Hope that helps.
LikeLike
I got an issue when uploading… Problem uploading file{“status”:{“isSuccess”:”false”,”xmlns:platformCore”:”urn:core_2014_2.platform.webservices.netsuite.com”,”statusDetail”:{“type”:”ERROR”,”code”:”INVALID_KEY_OR_REF”,”message”:”Invalid folder reference key SUITESCRIPTS/.”}}}
LikeLike
I believe NetSuite put an end to NetSuite-Sync as a method of uploading files. They no longer support credential based (non-TBA) access. I moved to NetSuite Upload and set it up using TBA (Token Based Authentitication).
LikeLike