Unable to find a matching line for sublist item with key: [orderLine] and value: [1]

烂漫一生 提交于 2020-05-28 04:51:49

问题


I am using SuiteTalk to create an item fulfillment from an existing sales order. This works for non-serialized orders, but not for serialized SOs.

I get the following error:

Unable to find a matching line for sublist item with key: [orderLine] and value: [1].

The line numbers do however match, since there is only one line, and this has line number "1". The line item does have a quantity of 3, each item being added to the fulfillment separately with the same line number. Could this be the problem?

My code:

ItemFulfillmentItem ffItem = new ItemFulfillmentItem();
ffItem.item = ifitemlist.item[b].item;
ffItem.itemReceive = true;
ffItem.itemReceiveSpecified = true;
ffItem.itemIsFulfilled = true;
ffItem.itemIsFulfilledSpecified = true;
ffItem.orderLineSpecified = true;
ffItem.orderLine = ifitemlist.item[b].orderLine;
ffItem.quantity = msg.despatchCartons[i].items[a].qtyDespatched;
ffItem.quantitySpecified = true;
ifitems.Add(ffItem);

For the specific fulfillment, the above code runs 3 times. This is because each of the 3 items on this Line has a separate serial number.

Any help would be appreciated. Thanks in advance!


回答1:


To resolve this, you need to create an Inventory Detail record for each line on the Item Fulfillment record. The Inventory Detail record will contain the serial number and quantity per serial number for the specific line item.

The SuiteScript 2.0 code for this, using a User Event script:

var currentRecord = scriptContext.currentRecord;
var subrecordInvDetail = currentRecord.getSublistSubrecord({
       sublistId: 'item',
       fieldId: 'inventorydetail',
       line: item_line_num
});

Run the following code for each serial number on your current line:

subrecordInvDetail.setSublistValue({
     sublistId: 'inventoryassignment',
     fieldId: 'issueinventorynumber',
     line: serial_num_line,
     value: 'Serial_Number'
});
subrecordInvDetail.setSublistValue({
     sublistId: 'inventoryassignment',
     fieldId: 'quantity',
     line: serial_num_line,
     value: 'Quantity_Value'
});
subrecordInvDetail.save();


来源:https://stackoverflow.com/questions/47307152/unable-to-find-a-matching-line-for-sublist-item-with-key-orderline-and-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!