can you specify the requirement and/or insert a screenshot such as the D365 FO application version? What do you exactly want to achieve?
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:
- Microsoft Licensing Guide
- Microsoft Doc`s/Learn