SupportCategory: Simple Object DesignerError with API Posting
Andy Gwynn asked 3 months ago

Have a current working API deployment for Purchase Orders w/ custom fields. Was working on adding the "shortcutdimension1code" to the API request however when posting a new document if a value for the dimension code is included in the request I receive an error message of:

"error": {
"code": "Internal_RecordNotFound",
"message": "The Purchase Header does not exist. Identification fields and values: Document Type='Order',No.='11208615'  CorrelationId:  39485d02-9c30-4129-8df4-914c0f68a7b5."
}

I have tried to put a non-valid value in the dimension code and receive the correct error

"The field Customer Code of table Purchase Header contains a value (10100) that cannot be found in the related table (Dimension Value)"

So it would seem that it is processing the request correctly to that point.  Have tried this is both VS and in Postman to verify results.  Also of interest, if I make an initial post request without the dimension property included and verify that the record has posted then make a second identical post request only adding the dimension property to the end the API will accept it, update the dimension value in the record however it removes other data from other fields.

Working json body for post:

{
"documenttype": "Order",
"buyfromvendorno_": "V03102",
"no_": "11208615",
"shiptoname": "iit",
"shiptoaddress": "1451Main street",
"shiptocity": "WAUKESHA",
"orderdate": "2024-04-24",
"postingdate": "2024-04-23",
"comment": false,
"receive": false,
"invoice": false,
"amount": 0,
"amountincludingvat": 0,
"vendorinvoiceno_": "Test Again ",
"shiptopostcode": "53186",
"shiptocounty": "WI",
"shiptocountryregioncode": "US",
"invoicereceiveddate": "2024-04-23",
"partiallyinvoiced": false,
"completelyreceived": false,
"pendingapprovals": 0,
"ngb_po_number": "1120861",
"customer_po_number": ""

}

Non-working body:

{
"documenttype": "Order",
"buyfromvendorno_": "V03102",
"no_": "11208615",
"shiptoname": "iit",
"shiptoaddress": "1451Main street",
"shiptocity": "WAUKESHA",
"orderdate": "2024-04-24",
"postingdate": "2024-04-23",
"comment": false,
"receive": false,
"invoice": false,
"amount": 0,
"amountincludingvat": 0,
"vendorinvoiceno_": "Test Again ",
"shiptopostcode": "53186",
"shiptocounty": "WI",
"shiptocountryregioncode": "US",
"invoicereceiveddate": "2024-04-23",
"partiallyinvoiced": false,
"completelyreceived": false,
"pendingapprovals": 0,
"ngb_po_number": "1120861",
"customer_po_number": "",
"shortcutdimension1code": "1010"

}
1 Answers
Best Answer
hougaard Staff answered 3 months ago
I don't think you can populate that field on the initial POST, but my guess is that it works on a PATCH call afterwards...
Andy Gwynn replied 3 months ago

Perfect, I will go that route then. Thanks for the help.