Invalid SoldTo Error with SubmitNewOrder REST endpoint

For the longest time I was using a POST to the “Erp.BO.SalesOrderSvc/SalesOrder” endpoint to create SalesOrders via REST. However after a particular update that endpoint began expierencing a bug where it would create blank releases with 0 quantity even though I never specified to. When I brought this up to Epiccare they said to use the “Erp.BO.SalesOrderSvc/SubmitNewOrder” endpoint instead and this is the recommended way to do this. However I keep getting an InvalidSoldTo error when trying to just create a SalesOrder header this way and cannot figure out why. I’m wondering if anyone else has come across this? I can create a sales order using this information in the client just fine. Any insight would be greatly appreciated.

URL: https://xxx.epicorsaas.com/xxx/api/v2/odata/xxx/Erp.BO.SalesOrderSvc/SubmitNewOrder

Payload:
{
“ds”: {
“OrderHed”: [
{
“OpenOrder”: true,
“VoidOrder”: false,
“Company”: “14281”,
“CustNum”: 5510,
“PONum”: “25867”,
“ReadyToCalc”: true,
“ReadyToFulfill”: true,
“Reference_c”: “”,
“EntryPerson”: “test”,
“ShipToNum”: “”,
“ShipViaCode”: “TSM”,
“FOB”: “ORIGIN”,
“ShipOrderComplete”: true,
“NeedByDate”: “2023-02-23T00:00:00+00:00”,
“WebOrder”: true,
“BTCustNum”: 5510,
“CreditCardOrder”: false,
“OrderSource_c”: “SS”,
“UseOTS”: true,
“OTSName”: “Redacted”,
“OTSAddress1”: “Redacted”,
“OTSAddress2”: “”,
“OTSAddress3”: “”,
“OTSCity”: “Cary”,
“OTSState”: “NC”,
“OTSZIP”: “27519”,
“OTSCountryNum”: 1,
“OrderComment”: “Redacted”,
“InvoiceComment”: “Redacted”,
“Plant”: “104”,
“FreightTerms_c”: “Collect”
}
]
}
}

Error:
{
“HttpStatus”: 400,
“ReasonPhrase”: “REST API Exception”,
“ErrorMessage”: “Order not processed.The following error occurred: Invalid Sold To.”,
“ErrorType”: “Ice.BLException”,
“ErrorDetails”: [
{
“Message”: “Order not processed.The following error occurred: Invalid Sold To.”,
“Type”: “Error”,
“Program”: “Erp.Services.BO.SalesOrder.dll”,
“Method”: “SubmitNewOrder”,
“ColumnNumber”: 21,
“LineNumber”: 33049
}
],
“CorrelationId”: “1ddd84a0-f658-4edb-9c3d-09517eb18130”
}

Is this a external web app or internal kinetic app?

I’m just trying to call this via postman.

Ok.

Your best bet to run a trace or create an order web kinetic and monitor the network tab of Dev Tools and youll see the calls epicor makes then clone them.

It will also give you boiler plate JSON.

That’s what I usually do, but in this case something odd is occurring. Tracing the screen says it’s using “https://xxx/api/v1/Erp.BO.SalesOrderSvc/MasterUpdate”. We were having some issues with this endpoint and Epicor support actually instructed us to use “Erp.BO.SalesOrderSvc/SubmitNewOrder” instead which is not what the kinetic screen uses, which is confusing.

For future people that come across this, it seems to have been related to customer setup maybe? I ended up refreshing that db with a copy of production and the issue went away so I think something was probably misconfigured on the customer itself.