{Tips & Tricks}–Show repeating content in Dynamics CRM 2016 word templates

Well, let me be very honest here. I hated to write this blog post. But to my surprise, I am finding lot of people wasting their valuable on this small stuff. So I thought, let me pen down this rather insignificant stuff so that it can help at-least someone stuck with the same issue.

I am not going to document here regarding the word template generation feature of Microsoft Dynamics CRM 2016. My personal favorite – http://crm.fueledbysleep.com/no-code/the-new-features-of-dynamics-crm-2016-how-to-use-them/#comment-3336 which explains both how you can use the word and excel templates to your advantage.

Here I am going to explain how to generate repeating content, for example – show all the emails related to an account.

First I download a template for the account entity. How to do it, you can find from the above post. As I am interested only in the emails, I have just included that relationship.

image

 

Now I insert a table. I wanted to include From address, to address and the subject of the email. So I create a table with the appropriate headers. I select a 3×2 table as I need an empty row after my header.

image

 

Now I select each of the three cells in the empty row of the above table and then insert appropriate fields. Another important point to note here is, if you want to display the From and To fields of the email, do not select the from and to. Instead select the fields – sender and torecipients. Otherwise the fields won’t display anything.

image

 

Now comes the important part. Select the entire row (all the cells of the row) using the cursor (do not select the table or the row from the table border)

Once the entire row is select, right click the relationship and then select Repeating as shown in the screenshot below.

image

 

It would look like something as below once you are done with the whole process. The biggest mistake people do here is select the entire table or select the entire row from the border of the table. If you do that, the table won’t be visible at all.

image

Save and upload the document template. To do this, please refer to the link I provided. Now once you view the template in the context of the account record, you can see all the emails.

image

 

Pretty layman stuff but hope it saves you some time.

Advertisements

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

9 thoughts on “{Tips & Tricks}–Show repeating content in Dynamics CRM 2016 word templates”

    1. Hi Jeff,

      Thanks for the appreciation.

      AFAIK Dynamics CRM word templates unfortunately does not have the option to filter records by view.

      Regards
      Debajit Dutta

  1. I know this is old and question slightly off topic. When including the Notes field in a repeater the template output does not honor Carriage Returns. All notes are strung together. Any idea if this can be manipulated?

    1. Hi Gerard,
      I remember facing this issue about an year back during one my demos to a customer.
      Let me just replicate this in this environment and then check for solutions.
      I will get back to you on this.

      -Debajit

    2. Hi Gerard,

      I know it has been sometime. I was mostly on the road and kind of stuck up. Sorry for that.
      While inserting a content control, you get two options, one is plain text control and other is rich text control.

      Could you try the rich text control and check if the carriage returns are respected.

      -Debajit

  2. Debajit, Thanks for this post. I remember finding it last time I had to touch this area of CRM (almost never). Quick and easy to follow.

    I have a situation where I want to repeat content for an entity as you describe, but also include a couple fields from a related entity. Though both relationships are included in the template, of course the “Repeating” designation is made once for the row. I’m getting the data for the repeating row, but the related entity data is not displaying. Is there a trick to this that you are aware of?

    Thanks again

    1. Hi Tim,

      I did a check on this. The problem is when you select repeating binding, internally word document will associate the dataset with the following path – w:xpath=”/ns0:DocumentTemplate[1]/account[1]/Account_Emails”. Here in my example, I applied a repeating content of emails associated with the account.

      Since for the repeating content, it goes directly to the child entity, I think the only way you could achieve this is by mapping the properties of the related parent in the child entity. and then include those fields in the repeating content.

      -Debajit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s