Is there a trick to getting fulfillment quantities...
# suitescript
t
Is there a trick to getting fulfillment quantities to auto populate into inventory details via script when transforming from SO? In the UI, you would click the Fulfill button to transform, then mark each line to fulfill and that is what is populating the quantity on the UI. However, doing the same thing via script (scheduled, ss2.0) the quantity is left blank. I ended up turning on dynamic mode for this transform, but can’t quite figure out what is needed to close out the inventoryassignement subrecord. Getting the “The total inventory detail quantity must be N” message after getting the subrecord, selecting a new line, setting quantity and inventorystatus, committing inventoryassignment, and committing the item.
fulfillment.selectLine({
sublistId: 'item',
line: j
});
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
value: true
});
var lineQty = fulfillment.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity'
});
// Create the subrecord for that line.
var subrec = fulfillment.getCurrentSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail'
});
subrec.selectNewLine({
sublistId: 'inventoryassignment'
});
subrec.setCurrentSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'quantity',
value: lineQty
});
subrec.setCurrentSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'inventorystatus',
value: 1
});
// Save the line in the subrecord's sublist.
subrec.commitLine({
sublistId: 'inventoryassignment'
});
fulfillment.commitLine({sublistId: 'item'});
b
either log the subrec, or use the debugger to check the state of the inventory assignment sublist before you commit it
netsuite may be automatically setting the inventory assignments for you
its especially common if you still have transactions lying around using the default inventory status