Managing and uploading massive document attachments

Managing and uploading massive document attachments

Since the inception of Dynamics 365 Finance and Operations, the system has lacked a standard solution to support bulk uploads of attachments. This limitation has persisted to the present day, making it a challenge for users and consultants who need to manage large volumes of attachments.

Data Management Framework (DMF)

The standard functionality within the Data Management Framework allows users to export and import attachments from tables using data entities. However, this capability is limited to transferring attachments between environments and does not address the need for efficiently uploading new attachments directly into the system.

So DMF does not support bulk uploading of attachments in a simple and efficient manner. And this is why customizations or workarounds are often required to meet business requirements. Below, I will demonstrate a workaround that allows us to achieve our goal and successfully upload attachments using Data Management.


Solution or Workaround

Export project

We will assume that the table to which we want to import the documents already has an attachment data entity. If it does not exist for your requirement, we should create it.

For this demo we will create an export project with Released product document attachments Entity with the following options.

Once is created, we should export it and download the package that the entity generates.

You can filter to download only a few records and it is enough since we only need the package and the resources that the system generates.

Exported package

The exported package will have the following structure:

Exported package

Resources folder contains the documents codified and comprimed.

The manifest file contains metadata about the package. It provides critical details such as the type, purpose, and content of the package.

The PackageHeader file provides detailed information about the data or components included in the package.

Released product document attachments Excel file will have the data entity mapping.

Exported excel file

New folder

The next step is create a new folder where we will copy the Excel, Manifest and PackageHeader files.

After this, we will start editing the new Excel. First we should start by deleting ATTACHEDDATETIME, ATTACHINGUSERID columns.

With the correct columns, we will add our new records following the data structure that the template had. But keeping the columns FILETYPE and ORIGINALFILENAME empty.

And in the column name AttachmentFileName we should map the path of the files that we want to upload.

NOTE: We must have our files local and accessible.

New excel file

Script

Now it is time to execute a script that will generate the resources folder containing our attachments. The script will also populate the missing fields in our Excel file and update the file paths with GUIDs linked to the corresponding resources.

Script: https://github.com/shashisadasivan/MyScripts/blob/master/D365/Powershell/FileUpload_ExcelResourceCreator.ps1

How to or what to take in count before executing the script:

Parameters needed and requested:

Parameters needed and not requested:

By executing the script, we will have our package fully prepared but not ready for import, the last step is to compress it as a zip.

Here is an example of how it should look:

Now, we can create our import project and test it. Be sure to select package as the format source!

As you can see, the six lines we originally had have been successfully imported into our system.


Thank you for reading! I hope this guide proves helpful to many of you. If youre using a different method to import attachments, please feel free to share—I’d love to hear about it!


Script credit to: Shashi Sadasivan

Shashi Sadasivan

D365 F&O Dev | Dog trainer

9mo

Thanks for crediting my script 😊 Awesome to see it !!

Ali Gul

Sr. Technical Consultant Dynamics 365 FO & Power Platform | Azure devops | Power Automate | Power BI | Data Migration | Automating Business Processes | 8+ Years in F&O

9mo

There is limitation in DMF package upload and download, it won’t work if the package size is more than 2 gigabytes. I have faced this issue when doing it for one of our customer. So had to upload in small chunks which took alot of time and effort.

To view or add a comment, sign in

Others also viewed

Explore topics