One of the new features of SuiteScript API 2016.2 is the ability to connect to SFTP Servers directly from NetSuite. We also understand the certain pitfalls as:

  • Not way to list the contents of a remote directory
  • No way of connecting using a private key.
  • 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.

However, this functionality is a great addition to NetSuite’s integration tool set. SFTP is a method of transferring files online similar to FTP. The difference is that SFTP has built in security (via SSH) to keep your data secure during transfer using internet. Actually Netsuite is providing certain approved algorithms (aes256-ctr, es192-ctr, es128-ctr) to make the connection secure to NetSuite file cabinet.

Script Snippet

var myFileToUpload = file.create({name: ‘file.txt’, fileType: file.Type.PLAINTEXT, contents: ‘File upload using SFTP API in SuiteScript 2.0’});

connection.upload({ directory: ‘/’, filename: file.txt’, file: myFileToUpload, replaceExisting: true });

You can use GUID (Global Unique Identifier) in NetSuite by a particular algorithm for the domain or script to upload the file. GUID, open the SFTP connection, and transfer files.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags :