function mergeTemplate(recordId, tranId, pdfFile, totalAmount, department) {
try {
let senderId = 4;
let recipient=5;
let approveURL = ‘https://4449540-sb1.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=1020&deploy=1&compid=4449540_SB1&h=c9cbe8c1bd3b61843636’ + ‘&po_id=’ + recordId + ‘&btn=true’; let rejectURL = ‘https://4449540-sb1.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=1020&deploy=1&compid=4449540_SB1&h=c9cbe8c1bd3b61843636’ + ‘&po_id=’ + recordId + ‘&btn=false’;
let emailTemplate = ‘<html><head>’ +
‘<style type=”text/css”>body {‘ +
‘ font-family: Arial, sans-serif;’ +
‘ }’ +
‘</style>’ +
‘</head><body>’ +
‘<table style=”width: 100%; border-collapse: collapse;”>’ +
‘<tbody>’ +
‘<tr>’ +
‘<td style=”text-align: left;”><img src=”https://4449540-sb1.app.netsuite.com/core/media/media.nl?id=4644&c=&h=QZXQie4tQABLh-4AUzVGGNs99GPWh_pdDOr9JEuSaGHFg0We” style=”max-height: 100px;” /></td>’ +
‘</tr>’ +
‘</tbody>’ +
‘</table>’ +
‘<p>Hi,</p>’ +
‘<p>Purchase <b>Invoice ‘ + tranId + ‘</b> is waiting for your approval.</p>’ +
‘<p>Please click on the link below to approve or reject the Purchase invoice.</p>’ +
‘<a href=”‘ + approveURL + ‘” style=”background-color:#4CAF50;border:none;color:white;padding:5px 15px;text-align:center;text-decoration:none;display:inline-block;font-size:12px;margin:4px 2px;cursor:pointer;border-radius:10px;”>Approve</a> ‘ +
‘<a href=”‘ + rejectURL + ‘” style=”background-color:#ff0000;border:none;color:white;padding:5px 15px;text-align:center;text-decoration:none;display:inline-block;font-size:12px;margin:4px 2px;cursor:pointer;border-radius:10px;”>Reject</a>’ +
‘<p>Thank you</p>’ +
‘</body></html>’;
//Send email with template and attchament as pdffile
email.send({
author: senderId,
recipients: ‘receipent ID’,
subject: ‘Purchase Invoice ‘ + tranId + ‘ is subject to your Approval’,
body: emailTemplate,
attachments: [pdfFile] })