1
votes

I'm trying to insert in sales order through suitescript and I always get an error on 'Location'. here's my request

{
 "recordtype" : "salesorder",
 "entity" : "142832",
 "location" : {
     "id":"395"
 }
}

and this is the response

{
     "error": {
        "code": "USER_ERROR",
        "message": "Please enter value(s) for: Location"
    }
}

and I tried changing the location value for example

"location" : "390"

the result would be

{
 "error": {
    "code": "INVALID_KEY_OR_REF",
    "message": "Invalid location reference key 390 for subsidiary <NULL>."
 }
}
1
Just a thought, but did you try setting the subsidiary as well? I create SOs all the time, and I have to enter the subsidiary (which has to match the customer, as well). Just my first thought...w3bguy
I tried adding the subsidiary to the request, but stll got an error here's the message 'Invalid subsidiary reference key 2 for entity 18546', but I check the customer and subsidiary they are both connected to each other. am I missing something?Roy Mustang
That is interesting. Something about that entity or that subsidiary are not messing well together. Can you creating the exact same thing in the UI?w3bguy
it's working on UI I mean on the netsuite web, and use the same subsidiary internal id and location internal id, but still getting an error on the postman requestRoy Mustang
That is a weird one. Since you have already validated that the data is valid for that sub, and that you can do the exact same thing in the UI, I would guess that you are getting one of the bad errors from NetSuite. I see those in about half of the errors returned. Where it says one error, but the actual problem is a completely different error. If that is your case, you'll have to get NetSuite to monitor on their end, to see what the actual failure is.w3bguy

1 Answers

1
votes

This error is occurring because the location is not "accessible" by the subsidiary associated with the customer. Subsidiaries are defined on the customer level, not on the sales order. You need to ensure the subsidiary chosen on the customer is contained within the subsidiary hierarchy of the location. To fix the issue you need to adjust the associated subsidiary of the location.

Here's more information on how to fix a very similar issue with items:

https://dashboard.suitesync.io/docs/resolving-errors#im-seeing-a-invalid-item-reference-key-123-for-subs