Craig
11/30/2022, 6:39 PMbattk
11/30/2022, 6:46 PMbattk
11/30/2022, 6:46 PMCraig
11/30/2022, 6:48 PMCraig
11/30/2022, 6:48 PMCraig
11/30/2022, 6:50 PMbattk
11/30/2022, 6:59 PMCraig
11/30/2022, 6:59 PMCraig
11/30/2022, 7:00 PMRyan Valizan
11/30/2022, 8:14 PMorderLinId: 12 === Line 13
0 index when dealing with sublists in 2.xCraig
11/30/2022, 8:14 PMCraig
11/30/2022, 8:14 PMCraig
11/30/2022, 8:15 PMRyan Valizan
11/30/2022, 8:15 PMCraig
11/30/2022, 8:17 PMCraig
11/30/2022, 8:19 PMbattk
11/30/2022, 8:19 PMbattk
11/30/2022, 8:19 PMRyan Valizan
11/30/2022, 8:20 PMif (!keepLineItem)
lineItemNum = fulfillmentRecord.getSublistValue({
sublistId: 'item',
fieldId: 'item',
line: i - fulfilledLines,
});
It wasn’t the most efficient means, but I had to compare the item fulfillment record against the sales order to ensure the lines were matching up, or add a flag to skip a sales order line when working with IF records
if (lineItemNum !== lines[i].SOitem) {
keepLineItem = true;
fulfilledLines++;
log.debug({
title: "lines[i].SOitem doesn't match ",
details: {
keepLineItem: keepLineItem,
lineDetailsItem: lineItemNum,
SOItem: lines[i].SOitem,
newFulfilledCount: fulfilledLines,
},
});
continue;
}
Craig
11/30/2022, 8:21 PMRyan Valizan
11/30/2022, 8:22 PMbeforeLoad
Ryan Valizan
11/30/2022, 8:22 PMbattk
11/30/2022, 8:22 PMRyan Valizan
11/30/2022, 8:23 PMRyan Valizan
11/30/2022, 8:23 PMbattk
11/30/2022, 8:25 PMconst fulfilmentLine = fulfilment.findSublistLineWithValue({
sublistId: 'item',
fieldId: 'line',
value: orderLineid
});
is an attempt to match fulfillment line id to order line id, which in general is wrong, but during create is fine since the fulfillment doesnt have line ids yet so the line id on the fulfillemt is temporarily the same as the sales orderRyan Valizan
11/30/2022, 8:25 PMif (itemRecord.type !== 'inventoryitem') {
log.debug({
title: "objRecord didn't match",
details: itemRecord.type,
});
keepLineItem = true;
fulfilledLines++;
continue;
}
if (lineItemNum !== lines[i].SOitem) {
keepLineItem = true;
fulfilledLines++;
log.debug({
title: "lines[i].SOitem doesn't match ",
details: {
keepLineItem: keepLineItem,
lineDetailsItem: lineItemNum,
SOItem: lines[i].SOitem,
newFulfilledCount: fulfilledLines,
},
});
continue;
}
Craig
11/30/2022, 8:27 PMCraig
11/30/2022, 8:27 PMCraig
11/30/2022, 8:27 PMCraig
11/30/2022, 8:28 PMRyan Valizan
11/30/2022, 8:29 PMCraig
11/30/2022, 11:57 PM