Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

HCLTech Microsoft Business Applications Practice Blog

for Dynamics 365, Power Platform and the rest of the Microsoft technology stack


Let’s Dive Deeper: One Click Document Generation in CRM 2016

Post Author: HCLTech |

In one of our previous blog posts, we offered up an excellent example of how to generate consistently formatted one click Microsoft Word documents. In today's blog, we are going to dive even deeper into that post and show you how to add and format a table in the document to have automatically repeating rows should there be more than one row of data that needs to be displayed from CRM. Let's start the steps!

1. First, download the Word template document that contains the CRM XML mapping information.

2. Insert a Word table that contains a sufficient number of columns for the CRM data and at least two rows (you may want a third for a 'Total' line or cell), of which the first will contain the column headers for the CRM data.

3. Add the column headers in the first row, and in the second row, add the fields from the mapped XML relationship. The last cell in our third row in this example is from the CRM rollup field total.

Let’s Dive Deeper: One Click Document Generation in CRM 2016

In order to make the field(s) row automatically repeat to accommodate all of the CRM data:

1. Select the entire row that contains the CRM fields.

2. Right-click on the XML mapping header that contains the included fields.

3. Hover over 'Insert Content Control' to reveal 'Repeating'.

4. Left-click on 'Repeating' to make the row automatically repeat as needed. 

There should now be a + sign at the end of the selected row indicating that the row is automatically repeating.  

Let’s Dive Deeper: One Click Document Generation in CRM 2016

As mentioned above, the third row, rightmost cell has been populated with the field that holds the calculated total for dataset within CRM and is obviously not repeating. Additional content may be added to enhance the presentation of the final document (i.e. in this example, separate areas of the document contain the Company name and Estimated Close Date from CRM via XML mapping as well as a Company logo). The completed template will be similar to the example below:

Let’s Dive Deeper: One Click Document Generation in CRM 2016

The document template is now ready to be uploaded into CRM per the instructions in the original blog.

To generate the document based on the new template from within CRM, follow these steps:

1. Navigate to the desired record (in our example, an Opportunity record was modified and used for purposes of this demonstration).

2. In the Command Bar, click on the ellipses, select Word Templates, and select the target template (1-Click Opp ProdLineItem in this instance).

Let’s Dive Deeper: One Click Document Generation in CRM 2016

The results will be similar to the document shown below. Note here that the Line Total and Grand Total are based on the Negotiated Price and Quantity, not the Base Price. The Grand Total was calculated within CRM and pushed to the generated document.

Let’s Dive Deeper: One Click Document Generation in CRM 2016

That's all for the blog today! Check out a video of our five favorite features in Dynamics CRM 2016 to learn more about the latest and great version of CRM from Microsoft!

Happy CRM'ing!

By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

One comment on “Let’s Dive Deeper: One Click Document Generation in CRM 2016”

PowerObjects Recommends