Craig
06/20/2025, 10:58 AMsoFulfillment.getCurrentSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail',
});
The resulting IF now has inventory details set on each of the fulfilled lines that matches the quantitycommited from the lines on the sales order.
I thought I would have to set the quantity and status but the transform appears to be pulling those through automatically after adding the above code.
I appreciate getCurrentSublistRecord actually adds the sublist record if not already present, I am surprised that the above code is enough to make the IF pull through the status and quantity though.eblackey
06/20/2025, 12:25 PMCraig
06/20/2025, 12:26 PMCraig
06/20/2025, 12:27 PMconst soFulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: so_ID,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});
Craig
06/20/2025, 12:36 PMconst soFulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: so_ID,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});
const lineCount = soFulfillment.getLineCount('item');
log.debug('lineCount', lineCount);
for (let i = 0; i < lineCount; i++) {
soFulfillment.selectLine({
sublistId: 'item',
line: i
});
soFulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
value: true
});
soFulfillment.getCurrentSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail',
});
soFulfillment.commitLine({
sublistId: 'item'
});
}
soFulfillment.setValue('shipstatus', 'C');
const fulfillmentID = soFulfillment.save({
ignoreMandatoryFields: true
})
The most interesting part of the scripteblackey
06/20/2025, 12:37 PMCraig
06/20/2025, 12:39 PMbt
06/23/2025, 12:39 PMCraig
06/23/2025, 12:39 PMbt
06/23/2025, 12:41 PMbt
06/23/2025, 12:41 PMJay Flynn09
06/26/2025, 4:56 PMCraig
06/26/2025, 8:29 PM