Setting up an SFTP Transfer

Written by
Manuelito Macalinao
Published on
October 31, 2023 at 1:38:41 AM PDT October 31, 2023 at 1:38:41 AM PDTst, October 31, 2023 at 1:38:41 AM PDT

Development Preparation for SFTP transfers

Follow these steps to successfully connect to your SFTP server with SuiteScript:

  1. Talk to your SFTP service provider about your plans.

    • Determine the connection properties required to connect with your external SFTP server. For example:

      • username

      • password/key

      • url

      • port

      • upload/download directories

      • host key

      • host key type

    • Make sure that you know your providers practices around host key changes, maintenance and failover. For example, find out if there are multiple URLs or ports to try.

    • Check compatibility with the SFTP ciphers supported by NetSuite. SeeSupported Cipher Suites and Host Key Types.

    • Determine if your provider requires at-rest file encryption (in addition to what the SFTP protocol provides during transfer). Decide if you need to add file encryption.

  2. Build a credential management Suitelet to capture username and password token. Then, test the connection.

    • Build a server script to handle operations such as:

      • Load a File Cabinet file and upload it to the SFTP server.

      • Download an on demand file from the SFTP server and save it in File Cabinet.

Execution of an SFTP transfer

The following steps occur during a successful SFTP transfer using SuiteScript:

  1. The user submits their SFTP credentials using a Suitelet.

  2. The Suitelet captures and stores the credential token.

  3. A server script is triggered.

  4. The script identifies the appropriate credential token and other connection attributes, and establishes the SFTP connection.

  5. The script requests the transfer.