Nadav Julius
12/26/2024, 6:48 PMMatt Carter
12/26/2024, 9:44 PMNadav Julius
12/27/2024, 2:52 PMDavid Na
12/29/2024, 12:29 PMNadav Julius
12/30/2024, 3:41 PMif (response.body) {
const responseBody = JSON.parse(response.body);
if (responseBody.status !== "success") {
alert("error occurred while getting the inventory detail");
return;
}
const { binNumberId } = responseBody.data;
if (!binNumberId) {
alert("No bin number id found for the location");
return;
}
// set the bin number id on the item fulfillment lines based on the response from the proxy
const lineCount = rec.getLineCount({ sublistId: "item" });
Array.from({ length: lineCount }, (_, i) => i).forEach((index) => {
rec.selectLine("item", index);
const hasInvDetSubrec = rec.hasCurrentSublistSubrecord("item", "inventorydetail");
if (hasInvDetSubrec) {
rec.removeCurrentSublistSubrecord("item", "inventorydetail");
const invDetSubrec = rec.getCurrentSublistSubrecord("item", "inventorydetail");
const quantity = invDetSubrec.getValue({ fieldId: "quantity" });
// Add single new line with bin and all quantity
invDetSubrec.selectNewLine("inventoryassignment");
invDetSubrec.setCurrentSublistValue("inventoryassignment", "quantity", quantity);
invDetSubrec.setCurrentSublistValue("inventoryassignment", "binnumber", binNumberId);
invDetSubrec.commitLine("inventoryassignment");
rec.commitLine("item");
}
});
}
Nadav Julius
12/30/2024, 3:42 PMinvDetSubrec.selectNewLine("inventoryassignment");
I also tried with selectLine
and explicitly stating the line in the setSublistValue
instead of doing current. Errors kept being thrown so I read NS docs and turns out that Inventory Detail is only available for "read" and "delete" in Client Scripts. Not edit.Nadav Julius
12/30/2024, 3:43 PM