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

How do I add attachments to VendInvoiceJournalLines using odata in D365 FO?

(2) ShareShare
ReportReport
Posted on by 4
 I'm trying to find a way to add attachments to accounts payable journal lines (VendInvoiceJournalLines ) using OData in D365 FO. But I'm stuck because can't find proper documentation. What to do? Like what entity or entities should I use? Do note that I don't get RecId and TableId in GET response of VendInvoiceJournalLines 
Categories:
I have the same question (0)
  • Suggested answer
    ANInnoSolutions Profile Picture
    526 on at
    Hi CU17071251-0,
     
    can you specify the requirement and/or insert a screenshot such as the D365 FO application version? What do you exactly want to achieve?
    Basically, and on the description above, find the following answer:
     
    To add attachments to VendInvoiceJournalLines using OData in Dynamics 365 Finance and Operations (D365 FO), try to interact with the document management framework via OData. However, this process is not straightforward because:
    - The VendInvoiceJournalLines entity itself does not directly expose attachment capabilities via OData
    - You can try to use the DocuRef and DocuValue tables/entities, which manage document attachments in D365 FO
     
    Overview:
    1) Identify the Record to Attach To
    - First, retrieve the RecId of the VendInvoiceJournalLine you want to attach the document to (This is necessary because the attachment is linked via RefRecId and RefTableId)
     
    2) Determine the Table ID
    - Use the SysTableIdView to find the TableId for VendInvoiceJournalLine
     
    3) Use the BusinessDocumentAttachment or DocumentAttachment Entity
    - These entities allow you to create a new attachment record
    - You’ll need to POST to the BusinessDocumentAttachments endpoint with e.g. (if you have a similar logic regarding the exact requirement by design, try to copy it out from the source code and use it):
     
    {
      "RefTableId": <TableId of VendInvoiceJournalLine>,
      "RefRecId": <RecId of the line>,
      "Name": "InvoiceAttachment.pdf",
      "TypeId": "File",
      "FileName": "InvoiceAttachment.pdf",
      "DocumentType": "Invoice",
      "Attachment": "<Base64-encoded file content>"
    }
     
    4) Base64 Encode the File
    - The file content must be encoded in Base64 before sending
     
    Anyway, be aware of some limitations when using OData like not all document types or entities are exposed via OData. If the VendInvoiceJournalLine is not supported, you may need to use custom data entities or custom services. Include other needed behaviors like Security needs or dataset status needs and what should happen when therefore a change in the UI is made.

     

    Rg,

    Alexander

    *Due to the complex and different possibilities of deploying Dynamics 365 I highly recommend not to setup the application without some expert/partner or support. (For more information contact me under anassl@inno-solutions.info or visit www.inno-solutions.de)

    *The Information comes directly from the manufacturer or provider and are validated (not guaranteed) up to date of creation of the posting.

    References:

    1. Microsoft Licensing Guide
    2. Microsoft Doc`s/Learn
  • Suggested answer
    Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at
    The standard (and recommended) solution is much easier. Look at VendorInvoiceDocumentAttachmentV2Entity (for example) and create a similar entity for posted journal lines . Most of the difficult work is done by the standard DocuRefEntity, which is one of the data sources. Then you don't have to expose record IDs, find the internal table ID and so on.
     
    I suggest you start by using the standard entity to add attachments to the pending invoice header. When you're familiar with the process, create the entity for posted invoice line attachments.
     
    The problem of the suggestion to use "BusinessDocumentAttachment or DocumentAttachment Entity" is than such entities don't exist.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 698

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 698

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans