web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Odata for attaching documents/links to the vendor invoices

(0) ShareShare
ReportReport
Posted on by 5

Hi, community

We are using VendInvoiceJournalHeaders and VendInvoiceJournalLines to post vendor invoices in d365 Finance.

I have been trying to find a way to add an attachment (pdf and link) to the vendor invoices via APIs, and unfortunately, I couldn't find an appropriate way.

Do you know what oData I can use to add attachments?

Thank you!

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Andrew,

    For the invoices, you will need to add attachments to the lines. Correct?

    If you are adding it to the AP invoice journal header, you can use data entity - LedgerJournalAttachmentsEntity. For the lines you might need to create a custom entity for ease of use.

    You could also try with the standard entity - DocuRefEntity, but you will need the RecId value for the LedgerJournalTrans line record.

  • Andrew29 Profile Picture
    5 on at

    Hi Gunjan, thank you for your reply!

    1. I wasn't able to find entity LedgerJournalAttachmentsEntity", but I have tried to use "VendorDocumentAttachments".

    ODATA:

    TEST.axcloud.dynamics.com/.../VendorDocumentAttachments eq 'ussi' and VendorAccountNumber eq 'US_SI_000128'

    Response:

    {

       "@odata.context": "TEST.axcloud.dynamics.com/.../$metadata

       "value": []

    }

    As you can see it is empty, but I have attachments for this vendor. Or I am making mistake with query or this end-point is not designed to provide such information.

    2. DocuRefEntity. You are right with that option I need to get somewhere the RecId value.

    End-point:

    TEST.axcloud.dynamics.com/.../BusinessDocumentDocuRefs

    Response:

           {

               "@odata.etag": "W/\"TEST2ODcxOTUwMic=\"",

               "DocuRefRecId": 68719477502,

               "URI": "https://test.co",

               "ContentBase64": "",

               "RestrictionStr": "Internal",

               "FileType": "",

               "DocumentType": "test",

               "TypeId": "URL",

               "Restriction": "Internal",

               "RefTableId": 9615,

               "Content": null,

               "Notes": "https://test.co",

               "RefRecId": 68719516771,

               "FileName": ""

           },

    So I need somehow to get DocuRefRecId or RefRecId for the Invoice header and then I can use this API to get the attachment OR to POST attachment.

    Do you know where I can get DocuRefRecId or RefRecId for invoice?

  • Andrew29 Profile Picture
    5 on at

    Hi Gunjan, thank you for your reply!

    1. I wasn't able to find entity LedgerJournalAttachmentsEntity", but I have tried to use "VendorDocumentAttachments".

    ODATA:

    TEST.axcloud.dynamics.com/.../VendorDocumentAttachments eq 'ussi' and VendorAccountNumber eq 'US_SI_000128'

    Response:

    {

      "@odata.context": "TEST.axcloud.dynamics.com/.../$metadata

      "value": []

    }

    As you can see it is empty, but I have attachments for this vendor. Or I am making mistake with query or this end-point is not designed to provide such information.

    2. DocuRefEntity. You are right with that option I need to get somewhere the RecId value.

    End-point:

    TEST.axcloud.dynamics.com/.../BusinessDocumentDocuRefs

    Response:

          {

              "@odata.etag": "W/\"TEST2ODcxOTUwMic=\"",

              "DocuRefRecId": 68719477502,

              "URI": "https://test.co",

              "ContentBase64": "",

              "RestrictionStr": "Internal",

              "FileType": "",

              "DocumentType": "test",

              "TypeId": "URL",

              "Restriction": "Internal",

              "RefTableId": 9615,

              "Content": null,

              "Notes": "https://test.co",

              "RefRecId": 68719516771,

              "FileName": ""

          },

    So I need somehow to get DocuRefRecId or RefRecId for the Invoice header and then I can use this API to get the attachment OR to POST attachment.

    Do you know where I can get DocuRefRecId or RefRecId for invoice?

  • AnithaEswaran Profile Picture
    2,032 on at

    Hi,

    I have not tried from Odata, but tried using DMF for attachment as Notes.

    anithasantosh.wordpress.com/.../

    This might give you some clue.

  • Andrew29 Profile Picture
    5 on at

    Thank you very much for taking the time to reply!

    Unfortunately, we can use only OData.

    I am using Postman and trying different end-points received via $metadata, but it is a guessing game...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 590 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 349

#3
Diego Mancassola Profile Picture

Diego Mancassola 263

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans