Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
nlapiSendEmail sending two copies of attachments
Hi,
I have a script that is automatically sending an email to a custom record in our system.
The (simplified) script is shown below
function afterSubmitPartnerApplication(type){
if (type != 'delete') {
var id = nlapiGetRecordId();
var type = nlapiGetRecordType();
var notification = nlapiGetFieldValue('custrecord_notificationsent');
if (notification == 'F') {
var status = nlapiGetFieldValue('custrecord_applicationstatus');
var name = nlapiGetFieldValue('custrecord_firstname') + ' ' + nlapiGetFieldValue('custrecord_lastname');
var hruser = '15386';
var emailRecords = new Object();
emailRecords['recordtype'] = 'customrecord_partnerapplication';
emailRecords['record'] = id;
var emailFields = new Object();
var attachments = new Array();
emailFields['NLFULLNAME'] = name;
var user = hruser;
var email = nlapiGetFieldValue('custrecord_emailaddress');
if (status == '13') {
var template = '105';