Jared Fraley
10/09/2023, 1:24 PMfunction setWorkOrders(creationList, poId, poType) {
if (creationList.length === 0) return;
var poRecord = record.load({
type: poType,
id: poId
});
for (i = 0; i < creationList.length; i++) {
console.log({
title: "Record " + i,
details: "Component: " + creationList[i].componentId + " | Work Order: " + creationList[i].createdRecord
});
var lineNumber = poRecord.findSublistLineWithValue({
sublistId: 'item',
fieldId: 'item',
value: creationList[i].componentId
});
console.log({
title: "Line Number",
details: lineNumber
});
if (lineNumber >= 0) {
poRecord.setSublistValue({
sublistId: 'item',
fieldId: 'custcol_related_work_order',
line: lineNumber,
value: creationList[i].createdRecord
});
}
}
poRecord.save();
return;
}