Skip to main content

Notifications

Announcements

No record found.

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!

  • Andrew29 Profile Picture
    5 on at
    RE: Odata for attaching documents/links to the vendor invoices

    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...

  • AnithaEswaran Profile Picture
    2,032 on at
    RE: Odata for attaching documents/links to the vendor invoices

    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
    RE: Odata for attaching documents/links to the vendor invoices

    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
    RE: Odata for attaching documents/links to the vendor invoices

    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?

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Odata for attaching documents/links to the vendor invoices

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,097 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,872 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans