I'm getting the following error when trying to assign a value to globalDimension1Code on an invoice create. The create works fine when that field is omitted but I need the value to be assigned (it's connected to the BU in the app).
status: 404
message: {"error":{"code":"Internal_RecordNotFound","message":"The Sales Header does not exist. Identification fields and values: Document Type='Invoice',No.='115055515' CorrelationId: 433de58d-1663-4934-a8a4-49e38754dc21."}}
I'm posting to this URL for the invoice create:
api.businesscentral.dynamics.com/.../salesInvoices
This is content of my invoice:
{
"number": "115055515",
"invoiceDate": "2023-03-08",
"customerId": "7e2759a8-37bd-ed11-9a88-000d3a363d43",
"dueDate": "2023-04-22",
"externalDocumentNumber": "7674307",
"shortcutDimension1Code": "10"
}
Hi,
One solution of this problem is that you insert Sales Invoice without shortcutDimension1Code and get id and if-Match (etag) of inserted document from response.
Then send another Patch request by appending that id in URL as api.businesscentral.dynamics.com/.../salesInvoices(id of inserted invoice) and using If-Match (available in response) parameter and body like
{
"shortcutDimension1Code": "ADM"
}
Other way is to use deep insert.
I realized I put the wrong thing in the subject of my post, it's shortcutDimension1Code, not globalDimension1Code. I copied that out of my code during a test before I changed it back to shortcutDimension1Code.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156