Usman Nawaz
07/06/2022, 7:34 PM// work order completion is transforming in dynamic mode
woCompletion.selectLine({ sublistId: 'component', line: 0 });
const componentInventoryDetail = woCompletion.getCurrentSublistSubrecord({ sublistId: 'component', fieldId: 'componentinventorydetail' });
componentInventoryDetail.selectNewLine({ sublistId: 'inventoryassignment' });
componentInventoryDetail.setCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'binnumber', value: bin });
componentInventoryDetail.setCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'quantity', value: quantity });
componentInventoryDetail.commitLine({ sublistId: 'inventoryassignment' });
woCompletion.commitLine({ sublistId: 'component' });
woCompletion.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
// Error is thrown on woCompletion.save()
// type: "error.SuiteScriptError",
// name: "PLEASE_CONFIGURE_THE_INVENTORY_DETAIL_FOR_1",
// message: "Please configure the inventory detail for line 1."
battk
07/06/2022, 8:50 PMbattk
07/06/2022, 8:51 PM