Export / Import attachments in Dynamics 365 Finance
Export / Import attachments in Dynamics 365 Finance
Document Management – Storing attachment and notes in D365 FO is a simple and easy go process . More information on configuring Document management is detailed in Microsoft document site.
Microsoft has provided an easy way to restore data from Tier-2 environments to other sandbox environments. But Attachment details are not exported in this case. So it would be a tedious job if the project is handling voluminous data with attachments.
More details on other missing data when exported is given as a screenshot below from the MS site,

Now, coming back to our main topic on how to export / import attachments in D365 FO.
There are many out of box entities in D365 FO to support in the export and import of document – Like CustomerAttachmentsEntity , EcoResDocumentAttachmentEntity etc.
For more entities, search in AOT with the below filter.

I tried using CustomerAttachmentsEntity for exporting the data, but it doesn`t export the field ‘FileContents’ which is needed while importing.
So I duplicated this entity and brought the logic for FileContents in POSTLOAD method.

/// /// Entity used to Dual-Write document attachments for the CustomerAttachmentsEntity table. ///
public class AECustomerAttachmentsEntity extends common
{
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/// <summary> /// /// </summary> public void postLoad() { super(); if(this.RecId && this.DocumentId!= emptyGuid()) { DocuRefEntity baseEntity; select firstonly baseEntity where baseEntity.DocumentId == this.DocumentId; this.FileContents = baseEntity.FileContents; this.fieldExternallySet(fieldNum(AECustomerAttachmentsEntity, FileContents), false); } } } |
Build and sync the changes.
Now, let us configure a data project and export this entity as XML format. (any format is supported). On exporting, with the File contents would be exported as Resources folder in export package.

Now, let us see on importing the package in another environment

Upload and add the package which we downloaded in the previous step.
After the successful import, we will be able to see the attachment in the customer record
posted on 2025-02-18 15:47 lingdanglfw 阅读(1) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2016-02-18 Dynamics AX Hostory