Reputation: 3
I am trying to create ItemReceipt which is created from PurchaseOrder. I am adding my inventory items manually in purchase order during its creation. When I am receiving this order NetSuite web service is throwing following error:
Adding new line to sublist item is not allowed.
while i have tried replaceAll attribute for ItemReceiptItemList as well.
Here is my code:
$tranDate = new \DateTime();
$tranDate = $tranDate->format('Y-m-d\TH:i:s');
$nsInventoryDetail = new InventoryDetail();
$nsInventoryAssignmentList = new InventoryAssignmentList();
$nsInventoryAssignmentList->replaceAll = true;
$nsInventoryAssignment[0] = new InventoryAssignment();
$nsInventoryAssignment[0]->receiptInventoryNumber = 3310; //NS inventory item id
$nsInventoryAssignment[0]->quantity = 1;
$nsInventoryAssignmentList->inventoryAssignment = $nsInventoryAssignment;
$nsInventoryDetail->inventoryAssignmentList = $nsInventoryAssignmentList;
$nsItemReceiptItem = new ItemReceiptItem();
$nsItemReceiptItem->item = new RecordRef();
$nsItemReceiptItem->item->internalId = 3310;
$nsItemReceiptItem->location = new RecordRef();
$nsItemReceiptItem->location->internalId = 1; // NS inventory location id
$nsItemReceiptItem->itemReceive = true;
$nsItemReceiptItem->rate = $purchasePrice->getAmount();
$nsItemReceiptItem->currency = $purchasePrice->getCurrency();
$nsItemReceiptItem->inventoryDetail = $nsInventoryDetail;
$itemList = new ItemReceiptItemList();
$itemList->item = [$nsItemReceiptItem];
$itemList->replaceAll = true;
$nsItemReceipt = new ItemReceipt();
$nsItemReceipt->createdFrom = new RecordRef();
$nsItemReceipt->createdFrom->internalId = 1223; // NS purchase order id
$nsItemReceipt->tranDate = $tranDate;
$nsItemReceipt->itemList = $itemList;
print_r($nsItemReceipt);
$nsItemReceipt = $this->itemReceiptService->create($nsItemReceipt);
Throws the following: Adding new line to sublist item is not allowed.
Following is my ItemReceipt object being sent:
NetSuite\Sdk\ItemReceipt Object
(
[createdDate] =>
[lastModifiedDate] =>
[customForm] =>
[exchangeRate] =>
[entity] =>
[currencyName] =>
[subsidiary] =>
[createdFrom] => NetSuite\Sdk\RecordRef Object
(
[internalId] => 1223
[externalId] =>
[type] => purchaseOrder
[name] =>
)
[tranDate] => 2020-01-02T13:45:36
[partner] =>
[postingPeriod] =>
[tranId] =>
[inboundShipment] =>
[memo] =>
[itemFulfillment] =>
[currency] =>
[landedCostMethod] =>
[landedCostPerLine] =>
[itemList] => NetSuite\Sdk\ItemReceiptItemList Object
(
[item] => Array
(
[0] => NetSuite\Sdk\ItemReceiptItem Object
(
[itemReceive] => 1
[jobName] =>
[item] => NetSuite\Sdk\RecordRef Object
(
[internalId] => 3310
[externalId] =>
[type] => inventoryItem
[name] =>
)
[orderLine] =>
[line] =>
[itemName] =>
[description] =>
[location] => NetSuite\Sdk\RecordRef Object
(
[internalId] => 3
[externalId] =>
[type] => location
[name] =>
)
[onHand] =>
[quantityRemaining] =>
[quantity] =>
[unitsDisplay] =>
[unitCostOverride] =>
[inventoryDetail] => NetSuite\Sdk\InventoryDetail Object
(
[inventoryAssignmentList] => NetSuite\Sdk\InventoryAssignmentList Object
(
[inventoryAssignment] => Array
(
[0] => NetSuite\Sdk\InventoryAssignment Object
(
[internalId] =>
[issueInventoryNumber] =>
[receiptInventoryNumber] =>
[binNumber] =>
[toBinNumber] =>
[quantity] => 1
[expirationDate] =>
[quantityAvailable] =>
)
)
[replaceAll] => 1
)
[customForm] =>
[nullFieldList] =>
)
[serialNumbers] =>
[binNumbers] =>
[expirationDate] =>
[rate] => 7900
[currency] => AED
[restock] =>
[billVarianceStatus] =>
[isDropShipment] =>
[options] =>
[landedCost] =>
[customFieldList] =>
)
)
[replaceAll] => 1
)
[expenseList] =>
[landedCostsList] =>
[accountingBookDetailList] =>
[customFieldList] =>
[internalId] =>
[externalId] =>
[nullFieldList] =>
)
Any help will be much appreciated.
Upvotes: 0
Views: 1174
Reputation: 1853
I found this working example here
https://www.reddit.com/r/Netsuite/comments/ewlen8/suitetalk_issue_creating_itemreceipt/
-soap:Body
-
-
<q1:createdFrom internalId="35023" type="purchaseOrder"/>
-<q1:itemList>
-<q1:item>
<q1:itemReceive>true</q1:itemReceive>
<q1:item internalId="1528"/>
<q1:orderLine>1</q1:orderLine>
<q1:quantity>100</q1:quantity>
</q1:item>
</q1:itemList>
</soap:Body>
All I had to do was change $item->line to $item->orderLine and that fixed the issue - looks like you need to reference the original purchase order line number
Upvotes: 0