Aly
04/03/2025, 4:36 PMCeligo AI
04/03/2025, 4:36 PMAI generated answer (using internal Slack threads):Based on the conversations, the error message you're encountering, "Adding new line to sublist item is not allowed," is due to the fact that when creating an Item Receipt from a Purchase Order via API, you cannot add new lines to the item receipt. Instead, you can only modify the existing ones. When creating an Item Receipt, you need to match your item receipt item lines to existing item lines on the receipt. This means that all the lines in the Purchase Order must be present also in the Item Receipt, regardless if those items are already received or not. Here's a sample code provided in the thread:
code
public static WriteResponse CreateItemReceipt()
{
ItemReceipt itemReceipt = new ItemReceipt()
{
createdFrom = new RecordRef()
{
internalId = "2973",
type = RecordType.purchaseOrder,
typeSpecified = true
},
tranDate = DateTime.Now,
memo = string.Empty
};
var itr = new ItemReceiptItemList();
itr.replaceAll = true;
List<ItemReceiptItem> itrItem = new List<ItemReceiptItem>();
itrItem.Add(new ItemReceiptItem());
itrItem[0].orderLine = 1;
itrItem[0].itemReceive = true;
itrItem[0].quantity = 1;
itrItem[0].item = new RecordRef();
itrItem[0].item.internalId = "116";
var itrDetails = new InventoryDetail();
var itrAssignList = new InventoryAssignmentList();
itrAssignList.replaceAll = true;
List<InventoryAssignment> itrAssign = new List<InventoryAssignment>();
itrAssign.Add(new InventoryAssignment());
itrAssign[0].internalId = "";
itrAssign[0].receiptInventoryNumber = "AAA00000000000001";
itrAssign[0].quantity = 1;
itrAssignList.inventoryAssignment = itrAssign.ToArray(); ;
itrDetails.inventoryAssignmentList = itrAssignList;
itrItem[0].inventoryDetail = itrDetails;
itr.item = itrItem.ToArray();
itemReceipt.itemList = itr;
itemReceipt.itemList.replaceAll = true;
var b = Client.Service.add(itemReceipt);
return b;
}
This code creates an Item Receipt from a Purchase Order, and it sets the replaceAll
property to true
for the ItemReceiptItemList
and InventoryAssignmentList
, which means it will replace all existing lines with the new ones you're providing.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/03/2025, 4:36 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865555525
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863841891
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851247311
Celigo AI
04/03/2025, 4:36 PM