A new feature introduced in Dynamics CRM 2016 Online and CRM 2016 on premise is the Word Templates. In this blog, we’ll use this new feature to generate a document with data from a CRM instance.

For creating a template, you would need MS Word to be in version 2013 or 2016. There are 3 ways to create a Word template.

Method 1

Considering that you would have the system admin access rights on the CRM instance, the first method to create a Word Template is from the Settings page. Go to Settings > Templates > Document Templates > New.

Method 2

The second method is creating personal templates. These templates are only available to the user creating the template.

For creating a personal Word template, open an existing record. For example, open an account record and then click (…) > Word Templates > Create Word Template.

Method 3

The third way to create a word template is from a list of records. For example, go to Sales > Accounts. From the list of records, select a single account, and then click (…) > Word Templates > Create Word Template.

Method 3 step by step Process

Let’s look into creating a template with the last method. This would again be a Personal Template.

Go to Sales > Account. From the record list, select an account record and click on the three dots (…).

active accounts

 

Then, select Word Templates > Create Word Template.

create word template

 

We’ll look into Excel templates in the next blog. For now, on the popup: 1) select the Word Template, 2) Select the entity (Account would be filtered by default), and 3) Click on “Select Entity”.

create word templates in dynamics crm

 

On the new pop up, we need to select the related entities from which we would input data onto the template.

select related entities

 

 

 

Let’s select Contact, Lead, Account and then Click on “Download Template”

download template

 

This would prompt to save the template on the local machine. Select a location and give the document an appropriate name. For example, “Account Summary <date>”.

Open this Word Template. The document would be blank.

open word template

 

To add CRM XML data, you need to enable the Word Developer tab. Go to File > Options > Customize Ribbon, and then enable Developer.

add crm xml data - word template

 

There are few known issues with the Word Template for Dynamics CRM feature, and there are few known resolutions. Let’s set them before we start with the template.

In the File > Options, go to “Proofing” and select “Autocorrect Options”.

autocorrect options word template

 

Deselect “Capitalize first letter of sentences” and “Automatically use suggestions from the spelling checker”

configure word template dynamics crm

 

In the Auto Format Tab deselect “Hyphens (–) and dash (—)”

crm word template autoformat

 

On the “AutoFormat As you Type” Tab deselect “Hyphens (–) and dash (—)” and Click OK.

crm word template autoformat 2

 

Now you would see a new “Developer” tab on the word document.

developer tab - word template

 

Select the XML Mapping Pane from the developer tab.

xml mapping pane - crm word template

 

The default XML schema is selected. Select the CRM XML schema. It will begin with “urn:microsoft-crm/document-template/”.

xml mapping - crm word template

 

Expand the CRM entity “account”.

xml mapping account

 

Type in the text required in the document and place the cursor where the CRM data is required. Account Name as in our Example:

word template example - crm

 

From the XML Mapping Pane, right click the entity field, and then click Insert Content Control > Plain Text.

xml mapping - insert content control

 

The CRM entity field is mapped to the word template.

crm entity field - word template

 

To display multiple related records, set the content control fields to repeat. Put fields with repeating data in a table row.

Select the entire table row in the template.

select entire table row - crm word template

 

In the XML Mapping Pane, right click the relationship containing the content control fields, and then click Repeating.

display multiple related records - crm word template

 

The table would be displayed as below:

display multiple related records - crm word template 2

Design the template as required and Save.

To upload this template into Dynamics CRM, Go to Settings > Templates > Document Templates, then click Upload Template.

word template - dynamics crm

 

Drag the Word file into the dialog box or browse to the file.

upload word template - dynamics crm

 

And then Click “Upload”.

upload word template - dynamics crm 2

 

The new document template record is created.

new document template created

 

Now to generate this document, Go to the list of account records > Select an account > select (…) > Word Template > Select the newly created word template (Account Summary_WordTemplate in our case)

generate document

 

Save the file to the local machine.

save file to local machine

 

Open the document. You would have all CRM data mapped to the designed document template.

This new feature can be used to generate simple Dynamics CRM mapped documents. For complex conditional document generation, Dynamics CRM add-on solutions like XperiDo would be handy. But hey, this is just the beginning!