Using ‘N/render’ module only needed data from a record can be passed from the suitescript to the xml file, which can be called inside the xml file.
var signature = search.lookupFields({
type: search.Type.EMPLOYEE,
id: currentUserdId,
columns: [‘custentity_jj_digital_signature’]
});
var digitalSignatureId = signature.custentity_jj_digital_signature[0].value;
log.debug(‘Digital Signature value’, digitalSignatureId);
var fileObj = file.load({
id: digitalSignatureId
});
var fileUrl = fileObj.url;
var currentDate = new Date();
renderer.addCustomDataSource({
format: render.DataSource.OBJECT,
alias: “JSON”,
data: {image: fileUrl}
});
renderer.addCustomDataSource({
format: render.DataSource.OBJECT,
alias: “Date”,
data: {currentDate: currentDate}
});
renderer.addRecord(‘record’, invoiceRecord);
renderer.addRecord(’employee’, employeeRecord);
var pdfFile = renderer.renderAsPdf();
This parameters can be called inside the xml file:
<table style=“width: 100%;”>
<tr>
<td style=“text-align: left; vertical-align: top;”>
<p><@filecabinet nstype=”image” style=”margin: 6px; width: 150px; height: 63px;” src=”https://8314533.app.netsuite.com”+”${JSON.image}” /></p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”><strong>Authorised Signatory</strong></p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”>Registered Office: RSP House 30 Museum Road, Bangalore – 560 001</p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”>Branch Office: RSP House 30 Museum Road, Bangalore – 560 001</p>
</td>
<td style=“text-align: right; vertical-align: top; padding-right: 140px;”>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”>Digitally Signed</p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”>Signed By:${employee.firstname} ${employee.initials}</p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 10px;”>Reason: Invoice</p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 9px;”>Loction: ${employee.location}</p>
<p style=“font-family: Arial, Helvetica, sans-serif; font-size: 9px;”>Date: ${Date.currentDate}</p>
</td>
<td style=“text-align: right; vertical-align: top; padding-left: 70px;”>
<#if record.custbody_jj_irn_einv_qr_code?has_content>
<barcode codetype=“qrcode” width=“150px” height=“150px” showtext=“true” value=“${record.custbody_jj_irn_einv_qr_code}”></barcode>
</#if></td>
</tr>
</table>