top of page
Post: Blog2_Post
HR-Analytics-Blog-Banner.jpg

Blog Article

Ely Beltran

Creating Seamless Integration: Uploading Files from NetSuite to Amazon S3

Written by: Ely Beltran

Background

NetSuite has the 'N/sftp' module for connecting to an FTP/SFTP server; however, this module does not support connecting to an Amazon S3 server. This sample code will illustrate the steps needed to integrate NetSuite and Amazon S3 directly.


Upload the NetSuite Amazon S3 folder

  1. Download the NetSuite Amazon S3 library, ns-aws-s3.js

  2. In NetSuite, go to Documents > Files > File Cabinet > SuiteScripts folder

  3. Create a new folder called ‘amazons3’; inside this folder, upload the ns-aws-s3.js file.

NetSuite Amazon S3 credentials

The following Amazon S3 information is needed to connect to the Amazon S3 server:

  • Access Key

  • Secret Key

  • Bucket

  • Region

NetSuite script to upload files to the Amazon S3 server

The sample script below is a scheduled script type that will load a CSV file in the NetSuite file cabinet and move this file to the Amazon S3 server.

Replace the variables with your own Amazon S3 details. Upon executing the script, it should create a copy of the file from the File Cabinet to the Amazon S3 server.

define(['N/file', '/SuiteScripts/amazons3/ns-aws-s3'],


function(file, AWS) {


function execute() {

try{


//Supply the Amazon S3 information

var options = {

region: 'xxx',

accessed: 'xxx',

secretAccessKey: 'xxx',

};


//Load the File - supply the Netsuite File Internal ID

var fileObj = file.load({

id: 100

});

var csvData = fileObj.getContents();


//Call the Amazon S3 library; supply the bucket info specific to your server

var s3 = new AWS.S3(options);

s3.putObject({

Bucket: 'xxx',

ACL: 'bucket-owner-full-control',

ContentType: 'text/CSV,

Key: name,

Body: csvData

}, function (err, data) {

if (err) {

log.error(JSON.stringify(err), 'here: ' + JSON.stringify(err.stack));

} else {

log.audit(data);

}

});

}

catch(ex){

log.error({

title: 'Error: Amazon S3 Uploader',

details: JSON.stringify(ex)

});

}

}

return {

execute: execute

};

});


Etter+Ramli as the Trusted, Independent Managed Services Provider for NetSuite

Using NetSuite Managed Services could be your growing company's best strategic move. NetSuite Managed Services offers a comprehensive solution, granting companies access to a team of experienced NetSuite administrators and consultants to manage their NetSuite ERP. Typically, this service is more affordable than hiring in-house staff. When you use managed services, your systems are always up-to-date. In the world of IT, systems are consistently upgraded and patched and come with a slew of security protocols. It is a lot to handle, but your teams can handle this when implementing managed services.

The goal is to ensure your NetSuite instance supports your business’ growth.

For over 20 years, Etter+Ramli has helped several companies optimize their NetSuite software solution. With a 95% customer satisfaction rate, Etter+Ramli can provide your company with world-class support, Certified NetSuite experts, and a value-based pricing structure.

Etter+Ramli As Your Extended NetSuite Team

Etter+Ramli is an Independent Managed Success Provider for NetSuite clients. We are NOT partnered with Oracle NetSuite and do not take commissions. We bring our knowledge, expertise, and passion for success to our clients. We help clients Buy, Deploy, Grow, and Abandon NetSuite. We engage as a client-side managed service to ensure our priorities align with our clients.

To explore the benefits of retaining Etter+Ramli as your Managed Success Provider, contact Todd Kimpton or visit our website for a free consultation today.

Comentarios


bottom of page