In certain circumstances, it might be required to generate a sizable document package that consists of hundreds or even thousands of elements. In previous situations, users ran into the following issues when generating such a package.
Challenges:
- Performance: Every element inside a Multipart-document is generated by the same document generation service which led to lengthy document generation processes
- File Size: Saving a single generated document would fail due to the file size exceeding the Dynamics 365 file size limit
- Storage: Storing every individual document as a note to Dynamics 365 led to increased storage costs
This article will tackle how to overcome these issues using our Multipart feature via Power Automate.
NOTE: If you are unfamiliar with how to construct a Multipart Flow, please view the article here.
1. Performance Improvements: Using Batchsplit
When it comes to performance improvements, batchsplit can help. This parameter, when added to the header of the Multipart XML, will split up the workload of generating a document package to multiple services. This ensures that a document package can be generated more efficiently.
NOTE: To use this feature, load balancing must be enabled (see more here).
2. Avoiding unnecessary capacity consumption and file-size limitations:
Using Concatenatetype
This parameter can help reduce the capacity consumed when generating documents by preventing the created document from being stored as a note to the temp record. You can include this parameter in each docpart that creates a document from a DCP template. The value of this parameter must be set to 96 as shown in the below image.
NOTE: When using this parameter, the final document will be saved directly to SharePoint, not Dynamics.
Example
To demonstrate these features in action, we can take a look at a particular use case.
In this example, we want to create a flow that generates multiple Multipart documents that consist of one template for each account record.
We begin by creating a few variables to be used, along with getting the list of account records. We will use both of these for a loop later.
After that, we add the Multipart XML header. At this step, you’ll notice we have added the batchsplit parameter. Then, we add another step for one of our variables.
At this point, we add a loop in order to loop through all of our account records. Inside the loop, we add our step with the concatenatetype parameter.
A condition step is added to check if we’re at the end of our list of records. If we’re at the end of our list, the XML footer is added, and then the document is generated via the Create Multipart document (sync) (V3) step. In the Save Location of this step, we include the URL to our SharePoint site to save our document. From there, the loop continues until all Multipart documents are generated.
Try it yourself!
Attached below in the “Attached Files” section is the Flow described in the example above. Try it out to see how these features work for you!
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.