Prashant Kala
08/06/2025, 5:18 PMCeligo AI
08/06/2025, 5:18 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems like you're encountering an issue with the inventory detail when transforming Purchase Orders (POs) into Vendor Bills and then trying to merge them. This issue seems to be particularly prevalent when dealing with serialized or lot numbered items. From the discussions, it appears that the issue arises when trying to partially bill a line item that is serialized and still attach it to the PO via CSV. It seems that NetSuite does not allow importing a bill created from a PO. In one of the threads, a user faced a similar issue while transforming a PO to a vendor bill. They were able to bill the complete quantity without any issues, but when they tried to partially bill the PO, they encountered an error. The user was able to resolve this issue by modifying the item receipt lines quantity to be the same as the Vendor Bill. They also mentioned that they handled this problem using the before submit event on the vendor bill. Here is the code they used:
javascript
var dataMap= getDataMap(params);
var vendorBillRec = record.transform({
fromType: record.Type.PURCHASE_ORDER,
fromId: params.purchaseOrderId,
toType: record.Type.VENDOR_BILL,
});
vendorBillRec.setValue({fieldId: 'tranid', value: params.vendorBillReferenceNumber});
lines = vendorBillRec.getLineCount({sublistId: 'item'});
var i = lines - 1;
while (i >= 0) {
var purchaseContract = vendorBillRec.getSublistValue({sublistId: 'item', fieldId: 'custcol_pocontract_ref', line: i});
if (!purchaseContract) {
vendorBillRec.removeLine({sublistId: 'item', line: i});
}
i = i - 1;
}
var lines = vendorBillRec.getLineCount({sublistId: 'item'});
for (var i = 0; i < lines; i++) {
var item = vendorBillRec.getSublistValue({sublistId: 'item', fieldId: 'item', line: i});
var lotNumber = vendorBillRec.getSublistText({sublistId: 'item', fieldId: 'custcol_lot_no', line: i}) ||
vendorBillRec.getSublistValue({sublistId: 'item', fieldId: 'custcol_lot_no', line: i});
var consignmentId = vendorBillRec.getSublistText({sublistId: 'item', fieldId: 'custcol_consignement_id', line: i}) ||
vendorBillRec.getSublistValue({sublistId: 'item', fieldId: 'custcol_consignement_id', line: i});
var key = item + '_' + lotNumber + '_' + consignmentId;
vendorBillRec.setSublistValue({sublistId: 'item', fieldId: 'quantity', line: i, value: dataMap[key].qty});
vendorBillRec.setSublistValue({sublistId: 'item', fieldId: 'rate', line: i, value: dataMap[key].rate});
var inventoryDetail = vendorBillRec.getSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail',
line: i
});
inventoryDetail.setSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'quantity',
line: 0,
value: parseFloat(dataMap[key].qty)
});
}
var vendorBillId = vendorBillRec.save({enableSourcing: true, ignoreMandatoryFields: true});
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/06/2025, 5:18 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.858207226
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841453969
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837628
Celigo AI
08/06/2025, 5:18 PMCeligo AI
08/06/2025, 5:19 PMPrashant Kala
08/06/2025, 5:37 PM