I am trying to add Sales Orders with items of type "Item Group" using SuiteTalk via the PHP Toolkit.
When the item is of other types, e.g. "Inventory Item, Non-Inventory Item", the orders is added without problems.
When the item is of type "Item Group", I get the following error:
Code: INVALID_KEY_OR_REF Message: Invalid price reference key 1 for item NNNNNN. Type: ERROR
Where NNNNN is the internal ID of the child Inventory Item connected to this Item Group
Here is how I set my SalesOrderItem:
$nsItem = new SalesOrderItem();
$nsItem->item = new RecordRef();
$nsItem->item->internalId = $orderItem->product->foreignId;
$nsItem->item->type = $orderItem->product->itemType;
$nsItem->item->typeSpecified = true;
$nsItem->price = new RecordRef();
$nsItem->price->type = "priceLevel";
$nsItem->price->internalId = "-1"; // the default custom price level
$nsItem->rate = $orderItem->amounts->price;
$nsItem->quantity = $orderItem->qty;
Any thoughts?
UPDATE:
I made a workaround - I am checking each Sales Order Item for its type and if it is "Item Group" I am populating the Sales Order with the items from this group. It is a little bit slower but works.