"We ensure Business Continuity even in disruptive times of COVID - 19 with our team continuously working remotely for our clients' success.
NetSuite Expert is focused, strongly encouraged to continue with home office."

Suitescript 2.0 APIs

SuiteScript 2.0 is the recommended API version for new SuiteScript development. Particularly, SuiteScript 2.0, it categorizes and separates the APIs into modules. Modules have replaced unstructured files.

We will update the modules regularly, however you can find some of them below as:

Record.id

/**
* Return the internal ID of a specific record.
*
* @return {int}
*
* N/record Module
*
* @since 2015.2

*/

email.send

Now you can generate email notifications out of NetSuite. All others are same limitations and restrictions that existed for SuiteScript 1.0 email API applies to SuiteScript 2.0.

Now you have the ability to notify bounce backs to sender. If sent WITH notify bounce back notification, NetSuite uses transactional email server. Transactional email server has higher chance of having email generate right away.

In SuiteScript 2.0, bounce back notification parameter is removed as parameter and exists as two different method calls.

Each email methods in SuiteScript 2.0 has matching promise version that can be used in Client Scripts as well.

/**
 * In NetSuite Debugger
 * 	require(['N/email']
 * 
 * In Normal Execution
 * 	define(['N/email']
 * 
 * This sample script is related specifically for N/email module. 
 * _file represents module required/defined and passed in as object by NetSuite
 */
require(['N/email'],

function(_email) 
{
	/**
	 * Object Properties when building Related Record JSON Object
	 * 		
	 */
	var relatedRecordJson = {
		'transactionId':'123', //Internal ID of transaction
		'activityId':'123', //Internal ID of activity type record: phone call, tasks, events, etc...'
		'entityId':'123', //Internall ID of entity type record: customer, contact, employee, etc...'
		'customRecord':{
			'id':'123', //Internal ID of custom record ID to attach to
			'recordType':'custrecord_test' //Internal ID of the cusutom Record ID
		}
	};
	
	//1. Send email WITH Bounce Back Notification
	/**
	 * Options for sending email
	 * 		author
	 * 		recipients
	 * 		replyTo
	 * 		cc
	 * 		bcc
	 * 		subject
	 * 		body
	 * 		attachments
	 * 		relatedRecords
	 * 		isInternalOnly
	 */
	//SuiteScript 1.0
	//nlapiSendEmail() with notifySenderOnBounce parameter as TRUE
	_email.send({
		'author':-5,
		'recipients':123, //Internal ID of NetSuite entity record 
		'subject':'Hello world I am 2 Sweet!',
		'body':'Saying HELLO!',
		'relatedRecords':relatedRecordJson
	});
	
	
	//2. Send email WITHOUT Bounce Back Notification
	/**
	 * Options for sending email
	 * 		author
	 * 		recipients
	 * 		replyTo
	 * 		cc
	 * 		bcc
	 * 		subject
	 * 		body
	 * 		attachments
	 * 		relatedRecords
	 * 		isInternalOnly
	 */
	//SuiteScript 1.0
	//nlapiSendEmail() with notifySenderOnBounce parameter as FALSE
	_email.sendBulk({
		'author':-5,
		'recipients':123, //Internal ID of NetSuite entity record 
		'subject':'Hello world I am 2 Sweet!',
		'body':'Saying HELLO!',
		'relatedRecords':relatedRecordJson
	});
	
	
	//3. Send Campaign Event Email
	/**
	 * Options for sending email
	 * 		campaignEventId
	 * 		recipientId
	 */
	//SuiteScript 1.0
	//nlapiSendCampaignEmail()
	_email.sendCampaignEvent({
		'campaignEventId':1234, //Internal ID of campaign Event 
		'recipientId':123, //Internal ID of NetSuite entity record 
	});
	
	
	//Depending on what script you are building,
	//	below section will return specific entry functions
    return {
    	
    };
    
});

1 2