Set item location via REST API when creating a new sales order.

I am able to set the location for a sales order, but attempting to set a location using internal id via “inventorydetail” does nothing but allow sales order creation and then attempting to use “inventorylocation” causes an error and does not allow sales order to be created. Is there a way to have the items in a sales order default to what the location is in the sales order or a way to set them via REST API sales order creation? Thanks!

When I go in and set the item location manually, if I get the JSON back for sales order with “expandSubResource” I get an “inventorydetail” section in the item json, but it only has a links object which is no help.

Could this be a permissions issue?

Rookie Asked on July 24, 2020 in Items.
Add Comment
8 Answer(s)

Best way we could solve this was to create a suite script for onsubmit/create of sales orders to update items from sales order location. It seems to work fine, but kind of disappointed with Netsuite and its REST API and it not being able to function how you would expect.

Rookie Answered on July 25, 2020.
Add Comment

I’m pretty certain that location lives on the line rather than the Inventory Detail. Can you share your request JSON?

Intermediate Answered on July 24, 2020.
Add Comment

We started sending location this way for line items, but it doesn’t work. Also tried “inventorylocation” but crashes new order creation, not sure how to specify location for a line item at this point

item.inventorydetail = {
          ‘location’: {
               ‘id’: location
          }
 };

Thanks!

Rookie Answered on July 24, 2020.
Add Comment

full json “redacted”

{
“customform”: 192,
“custbody_pct_tg_REDACTED_id”: “00000304”,
“otherRefNum”: “00000304”,
“externalId”: “00000304”,
“entity”: {
“id”: 150646
},
“subsidiary”: {
“id”: 2
},
“memo”: “REDACTED”,
“location”: {
“id”: “65”
},
“cseg_sales_channels”: 6,
“currency”: {
“id”: 4
},
“class”: {
“id”: 8
},
“email”: “REDACTED”,
“custbody_pct_tg_transaction_id”: “REDACTED”,
“ccApproved”: true,
“custbody_pct_tg_REDACTED_pmt_token”: “REDACTED”,
“custbody_pct_tg_actual_payment_method”: 3,
“custbody_pct_tg_card_type”: “Visa”,
“isTaxable”: true,
“taxRate”: 0.16,
“taxTotal”: 27.45,
“custbody_pct_tg_REDACTED_id”: “REDACTED”,
“custbody_pct_tg_REDACTED_tax_total”: 27.45,
“taxItem”: {
“id”: “1878”
},
“shippingCost”: 0,
“shipMethod”: 3417,
“billaddresslist”: {
“id”: 5962628
},
“shipaddresslist”: {
“id”: 5962628
},
“item”: {
“items”: [
{
“item”: {
“id”: 1738
},
“custcol_REDACTED_uuid”: “73157b3069cd856dbfa1f5b26e”,
“quantity”: 1,
“taxRate1”: 0.16,
“inventorydetail”: {
“location”: {
“id”: “65”
}
},
“amount”: 171.55,
“rate”: 199
}
]
}
}

Rookie Answered on July 24, 2020.
Add Comment

Another note, when attempting to use “inventorylocation” on an item instead, we get “Invalid value for field inventoryLocation in request body.” even though the internal id perfectly matches the correct location. Of course I may be mis-interpreting what inventorylocation field does =)

Rookie Answered on July 24, 2020.
Add Comment

Tried this structure?

“items”: [
{
“item”: {
“id”: 1738
},
“quantity”: 1,
“taxRate1”: 0.16,
“location”: {
“id”: “65”
}
}
]

Intermediate Answered on July 24, 2020.
Add Comment

Hi Abbot,

This is the error message I receive from Netsuite when putting location in the item like you have above.

An issue occured creating a new sales order in Netsuite : {“type”:”https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1“,”title”:”Invalid value for field location in request body.”,”status”:400,”o:errorCode”:”USER_ERROR”} : 00000401 : order-export-00000401-20200724.json

Rookie Answered on July 24, 2020.
Add Comment

Hi jsj,

This is baffling. I don’t get quite the same error as you but I can’t get location to stick and I do see an Inventory Detail link that doesn’t show up on any Saved Searches, etc.

Though your error does suggest more of a wrong value than invalid message??? The one thing I would note is that even in SuiteScript I’ve had issues with different Sales Order dropdown fields.
Equally, it may well be a Beta issue but I’d be intrigued to know how to get it working.

In terms of a solution, unless you need different locations at line level, you can remove it from the form. Would that work for you?

Thanks,

Chris

Intermediate Answered on July 24, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor