-
As the title says, I am having no luck adding item(s) to a Sales Order when using the NetSuite PHP API Client created by Ryan Winchester. I posted on Stack (https://stackoverflow.com/questions/75931178/netsuite-php-unable-to-add-items-to-new-sales-order), but have had no bites there. When I get to the items for the SO, I loop thru them as such:
Once I have all the items in the array, I add them to a SalesOrderItemList:
Then I add the item list to the Sales Order ($sale is created earlier in the script with: $sale = new SalesOrder();)
However, when I try to execute the creation of the Sales Order, I get this error:
I'm not sure where to go from here as each item is its own SalesOrderItem object. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
At a glance, it seems like you're building the request correctly, but something's obviously not quite right. My integrations are working fine, presently using 2022_1 web services, so there must be something going on that isn't evidenced by the info you've provided. If I was debugging this issue myself, the first thing I'd probably be doing is jumping into the code at the point that the request is about to be sent and then dump the entire request object to see exactly what your One other thing that could be worth trying is setting |
Beta Was this translation helpful? Give feedback.
-
@jrebs Thank you for the response. Unfortunately, I'm getting the same error. It all looks correct to me, but obviously, I'm doing something wrong. The SalesOrderItemList looks like this right before it is assigned to the SO:
And the SalesOrder object looks like this:
|
Beta Was this translation helpful? Give feedback.
-
Looks like you've nested the item list in your sales order incorrectly. The property |
Beta Was this translation helpful? Give feedback.
-
@jrebs Thank you. Changing "$sale->itemList->item = $itemList;" to "$sale->itemList = $itemList;" and realizing that $cartItem->item was supposed to be a RecordRef and not the internal ID alone, I was able to get this working. |
Beta Was this translation helpful? Give feedback.
Looks like you've nested the item list in your sales order incorrectly. The property
SalesOrder::itemList
should be of the typeSalesOrderItemList
. In your dump, it is a stdClass object containing an item list as itsitem
property.