Hubert
05/14/2018, 8:08 PMvar fulfillmentRecord = record.transform({ fromType : typeOfRecord, fromId : currentRecordInternalId, toType : record.Type.ITEM_FULFILLMENT, isDynamic : true });
var fulfillmentItemCount = fulfillmentRecord.getLineCount({ sublistId : 'item' });
for (var i = 0; i < fulfillmentItemCount; i++) // Loop through each item in the fulfillment record
{
fulfillmentRecord.selectLine({ sublistId : 'item', line : i });
var isBinItem = fulfillmentRecord.getSublistValue({ sublistId : 'item', fieldId : 'binitem', line : i });
if (isBinItem == 'T') {
var arrSorted = getSortedAvailableBinsFromRecord(fulfillmentRecord.getSublistValue({ sublistId : 'item', fieldId : 'location', line : i }), fulfillmentRecord.getSublistValue({ sublistId : 'item', fieldId : 'itemlocationbinlist', line : i }));
var fulfillmentInventoryDetail = fulfillmentRecord.getCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'inventorydetail' });
var qtyRemaining = parseFloat(fulfillmentInventoryDetail.getValue({ fieldId : 'quantity' }));
var ifItemBinCount = arrSorted.length;
for (var j = 0; j < ifItemBinCount; j++) // Loop through all of the bins for this item
{
var binNumber = arrSorted[j].binNumber; // Get the bin number's
var binAvailableQuantity = parseFloat(arrSorted[j].quantity);
if (binAvailableQuantity <= qtyRemaining) {
fulfillmentInventoryDetail.selectNewLine({ sublistId : 'inventoryassignment' });
fulfillmentInventoryDetail.setCurrentSublistText({ sublistId : 'inventoryassignment', fieldId : 'binnumber', text : binNumber, ignoreFieldChange : true });
fulfillmentInventoryDetail.setCurrentSublistValue({ sublistId : 'inventoryassignment', fieldId : 'quantity', value : binAvailableQuantity, ignoreFieldChange : true });
fulfillmentInventoryDetail.commitLine({ sublistId : 'inventoryassignment' });
qtyRemaining = qtyRemaining - binAvailableQuantity;
if (qtyRemaining === 0) {
break;
}
}
else {
fulfillmentInventoryDetail.selectNewLine({ sublistId : 'inventoryassignment' });
fulfillmentInventoryDetail.setCurrentSublistText({ sublistId : 'inventoryassignment', fieldId : 'binnumber', text : binNumber, ignoreFieldChange : true });
fulfillmentInventoryDetail.setCurrentSublistValue({ sublistId : 'inventoryassignment', fieldId : 'quantity', value : qtyRemaining, ignoreFieldChange : true });
fulfillmentInventoryDetail.commitLine({ sublistId : 'inventoryassignment' });
qtyRemaining = 0;
break;
}
}
}
fulfillmentRecord.commitLine({ sublistId : 'item' });
} //for
fulfillmentRecord.save();
With this code I am getting "PLEASE_CONFIGURE_THE_INVENTORY_DETAIL_FOR_1"
I have only one item on that order that I am trying to fulfill, items are available.
I think that I must be missing some subrecord submission but I can't find it ;(