• Release History
  • Documentation
  • Back to www.mscrm-addons.com
  • Release History
  • Documentation
  • Back to www.mscrm-addons.com
home/Knowledge Base/DocumentsCorePack(DCP)/How do I create a document that includes all child records of a certain entity?

How do I create a document that includes all child records of a certain entity?

1216 views 0 Updated on July 26, 2022

This article outlines how to set up a workflow that will generate a document that includes all child records that are related to a certain entity. Once the workflow is established, it will concatenate all these generated documents and send it to the account.

This feature is very useful if you, for example, would like to create a document that includes

– all quotes of a certain customer
– all contacts that are related to an account
– all invoices of a certain entity

In the now following step-by-step tutorial, we will create a document, that includes all contacts related to a certain account and concatenate it in one document.

Step 1: Create a new workflow for a random entity

If you have not created a workflow yet, please have a look at this blog article. In our example, we want to create a workflow for the entity account. Once the workflow is created, please add the DCPWorkflowSandbox: DCPCreateMultiPartXmlbassedonFetchxml step.

​
Figure 1: Workflow Activities

Step 2: Set the properties for the DCPWorkflowSandbox:DCPCreateMultiPartXmlbassedonFetchxml step
With a click on the [Set Properties]-button you add your individual properties to the parameters:

The first 3 properties allow you to define the settings for the conversion of the documents to .pdf and for the general SharePoint information. The other properties are explained below.

Template 1 Enables you to define the template which should be used
Entity Record URL Base Contain the Record URL of the Base Record (here: Account)
FetchXML Contains the FetchXML that resolves the relationship to the child.
In this example, it retrieves all child contacts of the account.
FetchXMLResultField Is the primary key field from the child record. In this case, it is the contactid
FetchXMLResultEntity Is the schema name of the result. In this example it is contact

Step 3: Create a FetchXML
We recommend you to use a FetchXML builder if you want to create a new FetchXML.

The FetchXML that is created for this workflow:

– defines which documents should be filtered and concenated
– resolves the 1:N relationship
– enables you to add an unlimited amount of filters

Here is the FetchXML that was created for this example:

<fetch count=”50″ >

<entity name=”contact” >

<attribute name=”fullname” />

<link-entity name=”account” from=”accountid” to=”parentcustomerid” link-type=”inner” >

<filter name=”account” from=”accountid” to=”parentcustomerid” >

<condition attribute=”accountid” operator=”eq” value=”qid” />

</filter>

</link-entity>

</entity>

</fetch>

Please note: It is of utmost importance that the qid (displayed above in red) is inserted because the workflow activity will replace the qid with the AccountId from the executed workflow. If qid is not inserted, the workflow cannot filter the results.

Figure 2: Set Custom Step Input Properties

​

Step 4: Create an AutoMergeWorkingItem
As the next step, you need to create the AutoMergeWorkingItem. Furthermore, the result XML from the CreateMultipartXMLbasedonFetchXML has to be added to the fieldMultiDocumentXML in the Advanced Section.


Figure 3: Set the MultiDocumentXML

The top of the AutoMergeWorking Item will look like below.


​

Figure 4: AutoMergeWorkingItems

 

Step 5: Start your workflow

The result of your workflow will be visible in the CreatedDocument-field in the AutoMergeWorkingItems-window (please see figure 4).​

Please note: You could as well combine this workflow with one that creates an eMail, attaches the here created document to an email, and sends the so created eMail to a certain group of people. Please read more about how to create such a workflow here.

​That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com!

Was this helpful?

Yes  No
Related Articles
  • DocumentsCorePack: Best practices for Dynamics 365 on-premises to online migration projects
  • Multilingual Support in DocumentsCorePack
  • Configure DocumentsCorePack within custom pages
  • Ensuring correct time zone display for DateTime fields
  • Document Generation Failure from Missing Privileges
  • Building Custom XML for Multipart documents
Latest Articles
  • DocumentsCorePack: Best practices for Dynamics 365 on-premises to online migration projects
  • Multilingual Support in DocumentsCorePack
  • Recap: ColorCloud 2025
  • Configure DocumentsCorePack within custom pages
  • AI-Powered Document Generation with Copilot in Sales
Popular Articles
  • DocumentsCorePack Template Designer – Getting Started
  • Step-by-Step: How to configure a One-Click-Action
  • Application Access for Dynamics 365
  • How to find your environment’s unique name in Microsoft Dynamics 365
  • How licenses are counted
Top Rated Articles
  • “Undefined”-labels in Chrome and Edge 114 and higher
  • Important information for Dynamics 365 online customers using DocumentsCorePack and/or AttachmentExtractor
  • How to activate the DocumentsCorePack Connector for PowerApps & Microsoft Flow
  • How licenses are counted
  • How to insert Condition Fields in DocumentsCorePack Templates designer
Categories
  • *News and General Infos* 62
  • Webinars 44
  • Template Designer(DCP 196
  • DocumentsCorePack(DCP 250
  • TelephoneIntegration (TI 65
  • AttachmentExtractor (AE 72
  • PowerSearch (PS 50
  • ActivityTools (AT 61
  • SmartBar (SB 54
  • GroupCalendar (GC 47
Our Vision

“We see it as our purpose to provide products that simplify and speed up our customers’ Microsoft Dynamics 365 experience.”

Knowledgebase
LogIn
mscrm-addons.com
  • Products
  • Online Shop
  • Downloads
  • My Account
About Us
  • About Us
  • Case Studies
  • Newsletter
  • Partner Program
  • Contact
Support
  • Support
  • Terms & Conditions
  • Documentation
  • Webinars
  • Legal Documents
  • Impressum
  • © 2022 www.mscrm-addons.com. All Rights Reserved.