With the new release of Microsoft Dynamics CRM 2016 comes the ability to generate Word templates on individual records. This new functionality provides the flexibility for users to create easy to edit predefined Word documents that you can populate with Dynamics CRM data at the click of a button.
In this blog post, I will cover an example on how to create a custom Microsoft Word template to generate a Letter for contacts.
Step One: Creating a Word Template
- Navigate to the Contact Select a single contact record, and then click More (…) > Word Templates > Create Word Template.
- After clicking Create Word Template, click the Select Entity
- The relationship selection now appears. In this example, we are using only the fields on the contact entity, so we do not need to select any relationship entities. Click Download Template. A word file will be downloaded to your local computer with the exported entity included as XML data. (For more information regarding entity relationships contact your CRM administrator).
Step Two: Enabling the Developer Tab
- Open the Word template file. The document will appear blank. To see and add XML data, you will need to enable the Word Developer tab.
- Go to File > Options > Customize Ribbon, and enable the Developer Click OK.
- The Developer tab now appears in the ribbon.
While editing the template, there are some issues to note that may cause Microsoft Word to freeze.
- You insert a content control other than a picture or plain text.
- You make a textual change, such as adding text or changing the capitalization to a content control. These changes can occur through Autocorrect as well. (making changes such as bolding is OK)
Turn off Auto correct to avoid issues and performance degradation
- Go to File > Options > Proofing > AutoCorrect Options
- Deselect Capitalize first letter of sentences and Automatically use suggestions from the spell checker.
- Click OK
Step Three: Defining the Word Template
- Click on the Developer Tab > Select XML Mapping Pane.
- The XML Mapping Pane will now appear on the right side of the Word document. Change the default XML schema to the CRM XML schema. It will begin with urn:Microsoft-crm/document-template/contact
- The attributes of the selected entities appear in the XML Mapping area. Expand the CRM Entity, right click the entity field and click Insert Content Control > Plain Text.
The CRM entity field is added to the Word Template.
Add any additional entity fields, add descriptive labels and text, and format the document. I have made an example letter below using the following content Controls:
Step Four: Upload the Word Template Back into CRM
There are 3 ways that could be used to upload a Word template.
- Navigate to Settings > Templates > Document Templates > Upload Template
- Navigate to the Entity > Select a record > click more options (…) > Select Word Templates > Click Create Word Template > Click the Upload
- Navigate to the Entity > Open a record > click more options (…) > Select Word Templates > Click Create Word Template > Click the Upload
Step Five: Generate a Document From the Word Template
- Navigate to the Contact Entity > Select a record > click more options (…) > Select Word Templates > Select the newly created Word Template (You may need to refresh your browser for the Template to appear)
- After you select your Word Template, CRM creates a Word document from the record you selected.
So there you have it, Word Templates are a great way to create standardized invoices, account summaries, form letters and more from your CRM records.