Create a suitelet script with the required details and return the results.
const findEmployeeRole = (invoiceRec, scriptContext) => {
try {
let docArrays = [];
let employeesWithRole = {};
let lineCount = invoiceRec.getLineCount({
sublistId: 'time'
});
for (let i = 0; i < lineCount; i++) {
let apply = invoiceRec.getSublistValue({
sublistId: 'time',
fieldId: 'apply',
line: i
});
if (apply) {
let docArray = invoiceRec.getSublistValue({
sublistId: 'time',
fieldId: 'doc',
line: i
});
docArrays.push(docArray);
}
}
let resultArray = getEmployeRoles(invoiceRec, docArrays);
let projectId = invoiceRec.getValue({ fieldId: 'job' })
scriptContext.response.write(`<#assign data = ${JSON.stringify({ lines: resultArray })}>`);
} catch (error) {
log.error("ERROR in findEmployeeRole", error)
}
}
Update PDF with suitelet link and pass the values
<#include "https://858219-sb1.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=1073&deploy=1&compid=858219_SB1&h=4466c5942a2d67a0be88&invoiceId=${record.id}&invoiceType=125">
<#if data.lines?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;border-collapse: collapse;border: 1px solid black;"><!-- start items -->
<thead>
<tr>
<th align="center" colspan="4" style="border-bottom: 1px solid black;"><p align="center">Consultant Name</p></th>
<th align="center" colspan="4" style="border-bottom: 1px solid black;">Role</th>
<th align="center" colspan="3" style="border-bottom: 1px solid black;">Start Date</th>
<th align="center" colspan="3" style="border-bottom: 1px solid black;">End Date</th>
<th align="center" colspan="4" style="border-bottom: 1px solid black;">Description</th>
<th align="center" colspan="3" style="border-bottom: 1px solid black;">Quantity</th>
<th align="center" colspan="3" style="border-bottom: 1px solid black;">Rate</th>
<th align="center" colspan="3" style="border-bottom: 1px solid black;">Amount</th>
</tr>
</thead>
<tbody>
<#list data.lines as line><tr>
<td style="vertical-align: middle;" colspan="4">${line.consultant}</td>
<td style="vertical-align: middle;" colspan="4">${line.billingClassName}</td>
<td style="vertical-align: middle;" align="center" colspan="3">${record.custbody_mfc_time_date_min}</td>
<td style="vertical-align: middle;" align="center" colspan="3">${record.custbody_mfc_time_date_max}</td>
<td style="vertical-align: middle;" align="center" colspan="4" line-height="150%">${line.description}</td>
<td style="vertical-align: middle;" align="center" colspan="3">${line.duration}</td>
<td style="vertical-align: middle;" align="right" colspan="3">$${line.rate?number?string(",##0.00")}</td>
<td style="vertical-align: middle;" align="right" colspan="3">$${line.amount?number?string(",##0.00")}</td>
</tr></#list>
</tbody>
<!-- end items --></table>
</#if>