mscrm-addons.com logomscrm-addons.com logo
  • Release History
  • Knowledge Base
  • Documentation
  • Contact Support
  • Release History
  • Knowledge Base
  • Documentation
  • Contact Support
home/Knowledge Base/Template Designer(DCP)/Creating a Conditional Row in a Table 

Creating a Conditional Row in a Table 

7 views 0

In some document generation scenarios, it may be necessary to display or hide an entire table row based on the data contained in a Microsoft Dynamics 365 record. A common example is a discount row in a quote template that should only be displayed when a discount has been applied. This can be achieved by using Condition Fields together with table structures in the DocumentsCorePack (DCP) Template Designer.  

This article explains how to create a quote template in which a discount row is only displayed when discount information is available. When no discount exists, the generated document will automatically use an alternative table layout without the discount row.  

Step 1: Set the base table

Before you start designing your template, you first need to define the base table. This selection determines which fields are available in the Template Designer. Keep in mind that once a field has been inserted into the template, the base table cannot be changed. For this walkthrough, click Insert Fields in the Fields group on the DocumentsCorePack tab. When DCP Template Designer opens, select Quote as the base table. 

Setting the base table to Quote
Figure 1: Setting the base table to Quote

Step 2: Create the product table

For our table, we will use the related Quote Line entity as the foundation. To configure this, we will open the Relationship Designer and locate the Quote->Quote Product relationship. Here we also resolve the Quote Product -> Product relationship, to include product details, such as product name etc., as shown below.  

Adding a relationship via the Relationship Designer
Figure 2: Adding a relationship via the Relationship Designer 

After saving the relationship, the corresponding fields appear in the Template Designer. Your Relationships list will then look like this:

Our relationships quote list
Figure 3: Our relationships quote list 

To create the table, double-click the field you want to add to the table. In our case, this is the Name field. This opens the Table Designer, where we will structure our table as follows:

Our table set-up in the Table Designer
Figure 4: Our table set-up in the Table Designer

Next, we will insert the required fields into the table. Then, we will add the Total Detail Amount field from the Standard tab into the footer. Once completed, the table should look similar to the example below: 

Our table with the required fields
Figure 5: Our table with the required fields 

Step 3: Insert a condition field

To control whether the discount row is displayed, we will insert a Condition Field beneath the product table using the Condition button in the Fields group in the DocumentsCorePack tab. 

The Condition button in the Fields group
Figure 6: The Condition button in the Fields group 

In the Condition Field properties window, fill in the Condition Name/Description. In the Condition Field Designer, we will configure the condition to evaluate the Total Discount Amount field. Select greater than as the operator and enter 0 as the comparison value. This ensures the condition is met only when the quote contains a discount. 

Configuring the Condition Field for the discount row
Figure 7: Configuring the Condition Field for the discount row 

The condition field is now inserted into the template as shown below.

Our condition field, located under our table
Figure 8: Our condition field, located under our table

Below this condition, we want to create another Condition Field for the Total row. Configure this condition in the same way as the previous one, as shown in the image below. 

Configuring the Condition Field for the total row
Figure 9: Configuring the Condition Field for the total row 

After adding both condition fields, your template should look similar to the example below. 

Our quote template with configured conditional fields
Figure 10: Our quote template with configured conditional fields 

To keep our data well-organized, we will insert standard 4×1 Word tables into each condition field.

Our Word tables in our condition fields
Figure 11: Our Word tables in our condition fields

In each table, we will add text labels for the discount and total values, making sure these elements are within the condition fields. We will also add a Join Tables field to combine the table above with the one below it. In our template, we want to include this field to create a cleaner and more organized table layout. You can add this field from the Insert Field menu.  

The Join Tables field
Figure 12: The Join Tables field

We will add the Join Tables field above the discount and total, making sure it is placed within the condition fields section. Then, we will add our relevant fields Total Discount Amount and Total Amount.

Our condition fields and tables with the relevant fields
Figure 13: Our condition fields and tables with the relevant fields 

Step 4: Generate the document 

The completed template should now resemble the following layout. 

Our created template
Figure 14: Our created template 

After merging the template with a quote record that contains a discount from our environment, the following result is produced.

Our generated document with a discount amount
Figure 15: Our generated document with a discount amount 

If the quote record instead contained no discount (a discount amount of 0), the condition field containing the discount is removed, ensuring the discount information is only displayed when a valid discount value exists.

Our generated document without a discount amount
Figure 16: Our generated document without a discount amount 

Tags:conditionQuotetemplate designconditional rowcondition fieldscondition row

Was this helpful?

Yes  No
Related Articles
  • Hiding Table Rows in Word Templates
  • Why do companies struggle to automate document processes in Dynamics 365?
  • Debugging the Template Designer Office Add-In 
  • Introducing the DocumentsCorePack Template Designer Office Add-In
  • Ensuring correct time zone display for DateTime fields
  • How to compare a date-fields with the current date 
Latest Articles
  • Hiding Table Rows in Word Templates
  • Creating a Conditional Row in a Table 
  • Recap: Scottish Summit 2026
  • Add Document Generation to Your Apps with AI
  • Recap: Nordic Summit 2026
Popular Articles
  • DocumentsCorePack Template Designer – Getting Started
  • Step-by-Step: How to configure a One-Click-Action
  • Application Access for Dynamics 365
  • How licenses are counted
  • How to find your environment’s unique name in Microsoft Dynamics 365
Top Rated Articles
  • “Undefined”-labels in Chrome and Edge 114 and higher
  • How to insert Condition Fields in DocumentsCorePack Templates designer
  • Important information for Dynamics 365 online customers using DocumentsCorePack and/or AttachmentExtractor
  • How to activate the DocumentsCorePack Connector for PowerApps & Microsoft Flow
  • Step-by-Step: How to configure a One-Click-Action
Categories
  • DCP for BC 2
  • *News and General Infos* 85
  • Webinars 49
  • Template Designer(DCP 200
  • DocumentsCorePack(DCP 277
  • TelephoneIntegration (TI 65
  • AttachmentExtractor (AE 81
  • 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
  • Cookies
  • © 2025 www.mscrm-addons.com. All Rights Reserved.