• Release History
  • Documentation
  • Back to www.mscrm-addons.com
  • Release History
  • Documentation
  • Back to www.mscrm-addons.com
home/Knowledge Base/Template Designer(DCP)/How to create a nested table structure 

How to create a nested table structure 

1927 views 1 Updated on June 17, 2024

There may be scenarios where it is required to create a nested table structure inside your template.  While DocumentsCorePack (DCP) does not natively support nested tables, it is possible to create such a structure by taking advantage of some of DCP’s features. 

In this article, we will walk through an example of creating a nested table structure using the Grouping and Static Document features of DCP. 

NOTE: If you are unfamiliar with Grouping and Static Documents, please learn more about these features within the following articles before continuing: 

  • Grouping 
  • Static Templates 

Our use case 

For our template, we want to create an account template that lists each related quote and each product from those quotes. This template will establish two one-to-many (1:N) relationships to achieve this: A 1:N relationship from Account->Quote, and a 1:N relationship from Quote->Quote Product.

We will get our data from the following record: 

account and quotes
Figure 1: Our account and its respective quotes
products from a quote
Figure 2: The products listed under one of our quotes, Quote A

Setting up the main template 

To begin with, we will create a new template and set our base entity to the Account entity.  We will also create a relationship and set up a new table based on the Quote entity. 

entites for template
Figure 3: Our entity set up for our main template

Next, we create the table by selecting the Name field from the Quote table.  Then, we apply grouping to the Name field.   

main template table
Figure 4: The main template’s table

In our primary row, we will remove the Name field entirely, but we will leave the same field in the header row alone.  In the grouping footer, we will remove the automatically added Name field and add the Total Amount (base) field instead. 

modified template table
Figure 5: The main template’s table, now modified

As it stands, this table, when merged, will simply list each quote.  To display the products from each quote, we now must create a separate template that we will include in this table, which we will refer to as our “sub template”. 

Setting up the sub template 

When creating our sub template, we must set the base entity of the template to be the entity which we based the table off from the main template.  Since the table in the main template was a Quote table, the base entity of our sub template must be the Quote entity. 

From there, we create our Quote Line table to retrieve our products. 

entity set up for sub template
Figure 6: Our entity set up for our sub template

In this template, we will create a table that will list each product from the quote.  We will include some additional information as well, such as the price per unit, quantity, and extended amount of each item. 

sub template table
Figure 7: Our sub template’s table

This table will act as our nested table that we will include in our main template.  However, before we can include it, we must save the sub template.  We will save our sub template under the name “QuoteProductSubTemplate.” 

Putting everything together 

With our sub template saved, we can now return to our main template to add it into our table.  To add it, we will first place our cursor into the main table row.  Then, we will access the Static Document window via the Insert Fields menu in the Template Designer while our table is selected in the Additional tab. 

Selecting the Static Document feature from the Additional tab
Figure 8: Selecting the Static Document feature from the Additional tab

In the Static Document window, we need to pass in the ID of the base entity from our main template into the sub template for it to retrieve the correct information.  In this case, we will add the Quote field (quoteid).  Then, we will add our sub template via Select Document and click OK. 

Setting up our sub template
Figure 9: Setting up our sub template

If the sub template has been added correctly, the table should now look like this: 

main template table with sub template
Figure 10: The main template’s table, with the sub template now inserted

Now, when we merge our template, our result document should now list each quote and their respective products. 

result table
Figure 11: Our resulting table

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

Was this helpful?

1 Yes  No
Related Articles
  • Ensuring correct time zone display for DateTime fields
  • How to compare a date-fields with the current date 
  • Create a template for XML or plain text
  • E-Invoicing with DocumentsCorePack
  • How to add content from SharePoint to a document
  • Using MS Word field codes in DocumentsCorePack templates
Latest Articles
  • Document Generation via Copilot in Dynamics 365 Sales using DocumentsCorePack
  • DocumentsCorePack: Best practices for Dynamics 365 on-premises to online migration projects
  • Multilingual Support in DocumentsCorePack
  • Recap: ColorCloud 2025
  • Configure DocumentsCorePack within custom pages
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 45
  • Template Designer(DCP 196
  • DocumentsCorePack(DCP 251
  • 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.