NetSuite Email Capture as Integration Option

Inbound Integration via NetSuite Email Capture

Integration with external applications in NetSuite comes in different forms – One of these hidden integration gems is the NetSuite Email Capture. It works by intercepting emails being sent into a specific NetSuite generated email address, and executes deployed NetSuite SuiteScript. Compared to other forms of integration options like Webservices, RESTLets, or Public Suitelets, NetSuite Email Capture is simple to setup and implement.

Here are some use case scenarios when to use this custom plug-in:

  • External system generates CSV report of prior days’ sales that must be imported into NetSuite
  • External website has an HTML form that collects new user information which ultimately needs to be pushed into NetSuite as Lead
  • Sales reps need to be able to send in a list of leads in CSV format to be quickly analyzed for duplicates and automatically kick off back end sales process

Before we get started on implementation steps, here are some limitations we’ve found:

  • As of NetSuite Release 2016.2, plugin scripts must be written in SuiteScript 1.0
  • Email Capture will NOT trigger if the email is generated from NetSuite
  • There is a usage limit similar to any other server side suite script. (Try not to go too crazy!)

Also check out Marty Zigmans’ post on NetSuite Email Plug-in to Automate Order Process post.

Custom Script Detail

Below is sample skeleton script written in SuiteScript 1.0 to implement the Email Capture interface. NetSuite will pass in the email object as the parameter by default. The sample script below includes all methods provided within the email object that developers can use.

/**
 * name of the function MUST be process
*/
function process(email)
{
	//Print out FROM email address
	nlapiLogExecution('debug', 'From Email Address', email.getFrom());
	
	//Print out TO email address
	nlapiLogExecution('debug', 'To Email Address', email.getTo());
	
	//Print out CC email Addresses
	nlapiLogExecution('debug', 'CC Email Addresses', email.getCc());
	
	//Print out Reply To Email Address
	nlapiLogExecution('debug', 'Reply To Address', email.getReplyTo());
	
	//Print out Email Sent Date
	nlapiLogExecution('debug', 'Send Date', email.getSentDate());
	
	//Print out Email Subject
	nlapiLogExecution('debug', 'Email Subject', email.getSubject());
	
	//Print out Email TEXT Body
	nlapiLogExecution('debug', 'Email Text Body', email.getTextBody());
	
	//Print out Email HTML Body
	nlapiLogExecution('debug', 'Email HTML Body', email.getHtmlBody());
	
	//Grab an Array of ALL Attachments
	var attachFiles = email.getAttachments();
	nlapiLogExecution('debug', 'Attachments Size', attachFiles.length);
	
	//Loop through list of ALL Attachments and find out details of each file
	for (var f=0; f < attachFiles.length; f+=1)
	{
		//Print out Attached File Type
		nlapiLogExecution(
			'debug', 
			'File Type', 
			attachFile[f].getType()
		);
		
		//Print out Attached File Name
		nlapiLogExecution(
			'debug', 
			'File Name', 
			attachFile[f].getName()
		);
		
		//Print out Contents of the File
		nlapiLogExecution(
			'debug', 
			'File Content', 
			attachFile[f].getValue()
		);
		
	}
}

NetSuite Email Capture Setup

  1. Make sure you have Server SuiteScript feature enabled on your NetSuite Account
  2. Navigate to create new Email Plug-In Script

    Email plugin path

    Navigation path to create Email Plugin

  3. Upload or select your newly created NetSuite Email Capture script and select Email
    Upload the script

    Select or Upload Email Capture script

    Email Capture selection

    Select Email Capture link

  4. Provide detailed meta data about this email capture plugin

    Create Email Capture Script Detail

    Create Email Capture Script Detail

  5. Activate newly created Email Capture plugin and test out sending in emails to newly created email address
    Navigation Path to Activate Email Capture

    Navigation Path to Activate Email Capture

    NetSuite Generated Email Capture Email Address

    NetSuite Generated Email Capture Email Address

Once this is set up, each time an external source, automated program, or user sends an email to a NetSuite generated email capture email address, NetSuite will execute the core of the email capture SuiteScript.

We’ve implemented different permutations of this NetSuite Email Capture integration for unique business requirements.

If you have a need for this type of integration, please feel free to contact us!

About Abaci
Abaci is a premier NetSuite Solution Provider with deep knowledge in both business process and technology architecture. Our team is passionate about NetSuite and has an exclusive commitment to NetSuite and to providing the highest level of system expertise on its full suite of cloud-based business management applications.