Invalid Ship To in ChangeCustomer When Creating Order in Epicor(REST API)

Hi,

I’m trying to create an order in Epicor Kentic I’m using REST API “Erp.BO.SalesOrderSvc/UpdateExt” But I’m getting this error I’m not able to understand.

If you could maybe help me how to see that method below it shows or if you can give me any clues it could help.

thank you

{
“HttpStatus”: 400,
“ReasonPhrase”: “REST API Exception”,
“ErrorMessage”: “Invalid Ship To.”,
“ErrorType”: “Ice.BLException”,
“ErrorDetails”: [
{
“Message”: “Invalid Ship To.”,
“Type”: “Error”,
“Table”: “OrderHed”,
“Field”: “ShipToNum”,
“Program”: “Erp.Services.BO.SalesOrder.dll”,
“Method”: “ChangeCustomer”,
“ColumnNumber”: 17,
“LineNumber”: 6137
}
],
“CorrelationId”: “d75356f8-7be6-4f60-8521-6f34266616af”
}

If I remove below checkbox below Error is coming:

image

{
“HttpStatus”: 400,
“ReasonPhrase”: “REST API Exception”,
“ErrorMessage”: “Invalid Sold To.”,
“ErrorType”: “Ice.BLException”,
“ErrorDetails”: [
{
“Message”: “Invalid Sold To.”,
“Type”: “Error”,
“Table”: “OrderHed”,
“Field”: “CustNum”,
“Program”: “Erp.Services.BO.SalesOrder.dll”,
“Method”: “ChangeSoldToID”,
“ColumnNumber”: 17,
“LineNumber”: 10587
}
],
“CorrelationId”: “5dd0183a0b36850sfe”
}

I have verified all the ship to and customer It feels good to me, I have problem only with few customers.
Finally, I’m pretty confused why it’s working like this?

Did you ever find a solution. I have the same issue. Thanks

I recommend that you enable the Allow One Time Ship to and then just pass the OTS text fields instead of trying to use a “Ship To”.

Same error for me after trying OTS solution:

{
    "HttpStatus": 400,
    "ReasonPhrase": "REST API Exception",
    "ErrorMessage": "Invalid Ship To.",
    "ErrorType": "Ice.BLException",
    "ErrorDetails": [
        {
            "Message": "Invalid Ship To.",
            "Type": "Error",
            "Table": "OrderHed",
            "Field": "ShipToNum",
            "Program": "Erp.Services.BO.SalesOrder.dll",
            "Method": "ChangeCustomer",
            "ColumnNumber": 25,
            "LineNumber": 6076
        }
    ],
    "CorrelationId": "..."
}

Make sure you do not include any parameters you are not using in the payload.

We use SalesOrderSvc to receive orders from an external system and only use these parameters. I’ve blotted out some custom fields that we use that are not pertinent to your situation.

Thank you for sharing that.
My payload looks like this:

{
	"Company": "200",
	"OrderNum": 0,
	"CustNum": 4215,
	"PONum": "41034",
	"EntryPerson": "SHOPIFY",
	"RequestDate": "2024-01-30T00:00:00",
    "TermsCode": "N30",
	"ShipViaCode": "FT03",
	"NeedByDate": "2024-01-25T07:00:00.000Z",
	"ReadyToCalc": true,
    "UseOTS": true,
    "OTSName": "Test Cust",
    "OTSAddress1": "151-1st St",
    "OTSAddress2": "A1",
    "OTSAddress3": "",
    "OTSCity": "Mystery",
    "OTSState": "AZ",
    "OTSZIP": "85142",
    "OTSCountryNum": 2,
    "OTSSaveAs": "",
    "External_ID_Shopify_c": "123",
    "OrderDtls": [
        {
            "Company": "200",
            "OrderNum": 0,
            "OrderLine": 0,
            "PartNum": "050DBA",
            "SalesUM": "EA",
            "SellingQuantity": 1
        }
    ]
}

Unfortunately, I’m still getting this:

{
    "odata.error": {
        "code": "",
        "message": {
            "lang": "en-US",
            "value": "The request is invalid."
        },
        "innererror": {
            "message": "entity : An error has occurred.\r\n",
            "type": "",
            "stacktrace": ""
        }
    }
}

It’s a non-ending battle between an invalid request and the ShipToNum being invalid…

So this may or may not be the problem, but when we create orders via REST, we send Order Numbers with a separate counter saved in the website DB. Specifically, we have a counter that is several million less than the Sales Order Starting Order (Company Configuration > Modules > Sales > Order, DB Field XaSyst.StartOrderNum).

That way as the Client-created order numbers increase, the REST order counter remains well below any already-created orders. We also pass in order line numbers.

I’m not sure if it was set up this way to avoid the conflict you’re running into, or if that was just standard procedure for our partners who manage the website for us.

The RequestDate value is invalid. There is no time zone included.

The request is invalid is usually caused by 1 of a few things.

  • The json is invalid. Paste it into an online json validator to eliminate that possiblity.
  • One of the parameters is typo’d.
  • One of the parameter values is invalid like missing time zone in a datetime value, string in an integer or integer in a string.

It’s a good thought, but I already tried doing all kinds of non-existent order numbers. I made sure they didn’t exist. Still no success…

Unfortunately not the issue either.

If you are on-prem, take a look at the app server log in Windows Event Viewer. That might give you some additional information. I’d still place my money on there is a parameter that is typed wrong or an invalid value.

I’d start stripping out parameter/value sets to only the required fields to create an order and then start adding parameters/values. It’s tedious but absent other information, it can be necessary. I don’t see anything wrong in your parameter names, but I’d remove the Shopify custom field as a starter.

I am on prem, but am not exactly sure where to find those logs.

I just copied all fields in ODATA by GETting another SO, modifying the fields, and then POSTing it back, but I’m still getting the same ShipTo error.
Updating orders using the same ShipToNum works perfectly fine…

I am even trying all the ShipToNums that are associated with the CustNum from the ShipTo table.

@danvoss @kve @jenjen7981 @vinodkumarkaluva

So i just got mine to work.

Here was my situation:
The ShipTo table, linked by the CustNum field, contains all shipping destinations (ShipTo) for a Customer. In the Customer table, the “ShipToNum” field, which I have populated (and I assume anyone who runs into this issue has as well), hinders the creation of a sales order for that customer. Once I set the Customer.ShipToNum field to blank, the sales order creation succeeded. From now on I recommend to avoid storing ShipToNums in the Customer table; creating a ShipTo entry for each customer seems more effective. One ShipTo row is automatically generated as a customer is created anyway.

Hope this helps.

Glad you were able to solve this!

1 Like

The app server event log wasn’t helpful. I did take your payload and tweaked it to match values in my test system.

There are 2 value problems. The RequestDate and NeedByDate values are invalid. Change the values to include the offset from GMT instead of Z

Example - “2024-01-30T00:00:00-06:00”

Once I made that change the order created no problem. Sorry if my example led you astray.

1 Like

No worries, I got something to work :laughing:
Good to know about the date format though!
I appreciate your efforts.