We're using Dynamics 365 BC on Cloud, and successfully tested the API v2.0 to query, filter, update purchase orders / lines. We now want to "Receive and Invoice" from a PO using API, the same way we do in UI:
It seems that this kind of basic action needs custom extension ? Is that correct ? How to do that ? Could somebody share an example ?
Thanks !
Hi Vincent, still waiting.. are you planning to share your results and examples any time soon..
Hi,
I'm currently out of the office, I'll share results and examples here soon.
Vincent
Hi Vincent, I am exactly trying to do the same thing you completed.
I know how to create PO using API. Now we need to create a PO Invoice in 2 ways:
• "Receive and Invoice" totally or partially the PO
• "Invoice only" totally or partially- if receipt already exists
I would really appreciate if you can share how you did it, what method we need to use and if you can provide some examples.
Thanks!!
Yes but it never return values:
Call example: {{baseUrl}}/companies({{companyId}})/attachments?$filter=parentId eq bf4eb7ea-d558-ec11-bb7c-000d3a2b9aee and parentType eq 'Purchase Invoice'
Always returns:
{
"@odata.context": "api.businesscentral.dynamics.com/.../$metadata
"value": []
}
but this Purchase Invoice is valid and has attachment (not found in attachment table but in 'Document Attachment' table)
And no idea on how to get 'Attachment Notes'
...
Have you looked at the attachement API ?
Hi,
It seems that the Purchase invoice attachments are stored in 'Document Attachment' table but we did not find any API to manipulate these data.
In addition we want to add/update 'notes' data available on purchase invoice attachment thumbnail.
Any idea on how to do that using API ?
Should I create a new thread for this ?
Thanks,
Vincent
Thanks Inge.
We'll try this API and share results.
This should be possible using the attachement API
We're now able to complete the full process using API
We w'd like now to either push a PDF file as an attachment to the newly created Purchase Invoice, or add a link to it using attachment note visible in UI.
We did not find the correct way to push this information. Any suggestion ?
Thanks,
Vincent
Hi,
The record update using PATCH is finally working fine with the above code, we just misunderstanding the URL scheme to be used.
PATCH 'api.businesscentral.dynamics.com/.../{myAPIPublisher}/PurchaseOrder/v1.0/companies(99a224b4-d558-ec11-bb7c-000d3a2b9aee)/Purchaseorders(8de8bee4-d558-ec11-bb7c-000d3a2b9aee)' \
--header 'If-Match: *' \
--header 'Authorization: Bearer *** \
--header 'Content-Type: application/json' \
--data-raw '{
"vendorInvoiceNo": "TEST NUM"
}'
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156