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.
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.
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.
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.
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.
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.
Pretty layman stuff but hope it saves you some time.
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.
Nice post! do you know if there’s any way to filter out inactive rows from the repeating rows?
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
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?
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
Wow thanks
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
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
Hi Tim,
Thanks for reading my blog post.
I will check on this and revert.
Best Regards
Debajit
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
So I have been searching for how to do a repeating row of data that also has repeating data underneath it. So for instance in Dynamics NAV we have Jobs which have Task Lines and then under them has Planning Lines. I am trying to build a Word document report to serve as a Quote/Contract that would have the Task lines repeating which I have and works fine, but under each repeating Task line I would like to have its repeating Planning lines nested underneath it to show more detail of the job.
I have not been able to find anywhere that this is explained how to accomplish or if it even can be accomplished. Any ideas?