Browsed by
Tag: suitelet

Suitescript 2.0 SFTP Tool

Suitescript 2.0 SFTP Tool

One of the new features of SuiteScript API 2016.2 is the ability to connect to SFTP Servers directly from Netsuite.

Here are some downsides I found:

  • Not way to list the contents of a remote directory <– This has been added
  • No way of connecting using a private key. <– This has been added
  • Not all SFTP servers are supported as Netsuite requires the server to support some encryption algorithms.
  • No way of obtaining the server’s hostkey natively.

 

Unfortunately the process is a bit confusing if you are new to the SFTP world so I created a tool that will help you jump-start your script. I found this tool very useful as I was able to test an SFTP connection quickly for a client and turned out the SFTP server that they were trying to use didn’t actually support Netsuite’s approved algorithms (aes256-ctr, es192-ctr, es128-ctr), so it saved me a lot of time as I was able to quickly discard it and move on.

I also included an endpoint to get the HostKey of the URL you are trying to connect to. I think this will be very useful for people who don’t have a Linux server lying around where they can run ssh keyscan.

Note: The HostKey endpoint should be used to grab the hostkey and store it elsewhere on your end. Do not use the endpoint to request the hostkey every time you make a request. If your server HostKey changes very frequently then I suggest to build your own tool.

Here’s a video tutorial:

https://www.youtube.com/watch?v=azxo7GS3xRQ

 

And here’s the code ready to be uploaded as a Suitelet, have fun!:

Suitescript 2.0 Quickstart Examples

Suitescript 2.0 Quickstart Examples

Here I will be posting the most used scripts from Suitescript 2.0. These code examples are meant for beginners to be a quick start so they can quickly get a script started and add their code to them. I tried to keep them short. If you are a beginner I recommend you to check Netsuite’s Help section and navigate to Suitescript 2.0 API so you can learn more about each.

 


Client Script

Note: Check out how the helper functions in clientscript have to be nested inside the main runClientscript function. This is something particular to client scripts.


User Event Script


Scheduled Script


Suitelet


RESTlet

Leave a comment if you want to see other examples.

Getting Started with Serverless Integrations

Getting Started with Serverless Integrations

Serverless functions (also known as functions as a service) can help you simplify your integrations because you only need to code your logic in a function and the service provider will take care of all the backend hardware, scaling, OS, availability, instances, etc…

Other benefits of serverless technology are that the hardware and software is fully managed, scales automatically almost instantly, and you only pay whenever your function runs so it can be very inexpensive.

Some of the most popular serverless providers are Amazon Lambda, Azure Functions and Google Cloud Functions.

For this demonstration we will use Google Cloud Functions. We will integrate a Shopify Webhook with Netsuite. My code will run in NodeJS Javascript and the rest will be managed by Google. As a developer coming from a Netsuite background I found it extremely easy to get started with Google Cloud Functions. Additionally, when considering your network infrastructure, incorporating an Aruba unmanaged switch can offer simplicity and reliability in managing your local network. Unmanaged switches, like those from Aruba, are plug-and-play solutions, making them ideal for smaller setups, providing basic connectivity without the need for advanced configuration, complementing the streamlined and efficient nature of serverless functions for your cloud-based operations.

You can set this up within minutes as explained in this video: https://youtu.be/nOlfG5oGets 
Google Cloud Functions Code:

 

This was a quick demonstration on how to get started. From here you can expand the code and keep developing to make your function more robust.

Some suggestions on first things to do:

  • Secure your function by adding a password.
  • Add more logging and different levels of logging.
  • Branch out the logic depending on the data being received.
  • Add node plugins.
  • Make use of other Google Cloud Services such as Google Datastore or Google Storage.