VSCode + NetSuite, Lovin’ It!

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:

  1. Install VSCode – https://code.visualstudio.com/download
  2. Install NetSuite-Sync : npm install – g netsuite-sync
  3. Create a config file: ns -g
  4. This prompts you for user ID & password
  5. Then it prompts for a NetSuite folder ID
  6. Then it creates a NetsuiteConfig.js file with all your info unencrypted
  7. Next install “Git for Windows” – https://git-for-windows.github.io
  8. Open the Git Bash command prompt
  9. CD to the folder where you created your NetsuiteConfig.js file.
  10. Type: export NSPW=”some encryption seed”
  11. Then encrypt your NetsuiteConfig.js file by typing: ns -e
  12. Then delete your NetsuiteConfig.js file, since you’ll be using the encrypted version.
  13. In VSCode [ctrl] + ` or … View >> Terminal
  14. In the terminal window, type:
    ns -u {some javascript file name in the same directory}
  15. 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.

  1. Let’s set VSCode to auto-save. File >> Preferences >> Settings
  2. Type in “auto save” to find the following:
    auto-save
  3. These are my auto-save settings. Feel free to make yours look like mine.
  4. In VSCode’s editor window, hit F1 to open the command center.
  5. Type: shortcuts
    shortcuts
  6. select the highlighted option (in yellow)
  7. Add the following key binding:
    keybindings
  8. 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!

 

16 thoughts on “VSCode + NetSuite, Lovin’ It!

  1. Anh says:

    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

    Like

  2. 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
    }

    Like

    1. 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.

      Like

  3. arielanasco0 says:

    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/.”}}}

    Like

    1. 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).

      Like

Leave a comment