Discussions
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';