› Dynamics CRM › Document Generation in Dynamics CRM 2016
Document Generation in Dynamics CRM 2016
In this article, we will review the new and improved out-of-the-box capabilities to generate documents that contain data from CRM records. Users can now create Word and Excel templates for letters, agreements, quotes, invoices and other, in just a single click!
Out of the box Templates
Out of the box, here are the templates Microsoft includes with the CRM 2016 release
Figure 1.0 1
To run the Template you’ll first need to select the appropriate record. For the Account Summary Template, select an Account record and select it from the Action menu. As shown in Figure 2.0 1.
Figure 2.0 1
Account (Cloudfronts Technologies LLP) Summary template is generated.
Figure 3.0 1
Open the Account Summary.docx file.
Figure 4.0 1
Create a new Excel Template
Go to Settings – Templates – Document Templates. Click on +New to launch the wizard.
Here you can select either Excel or Word templates, the entity and the View. The Edit Columns link provides users a quick way to add columns to the template similar to that of an Advance Find. CRM knows where to display the template file based on the entity selection.
If you already have a template, choose Upload, otherwise choose Download to see what CRM created as the Template based on your field selections.
Figure 5.0 1
To upload a file we need to just drag & drop in the box and click the upload button
Figure 6.0 1
Once the upload is complete, the template record is displayed.
Figure 7.0 1
Once you have selected the Template, you also have the ability to set the security roles and control.
Figure 8.0 1
Create a Word Template
Go to Settings – Templates – Document Templates and click +New. Choose the Word Template, select the entity and press Select Entity button.
Figure 9.0 1
A wizard form opens to provide options in navigating across various entities depending on the relationship types.
Figure 10.0 1
The relationships you select on this screen determine what entities and fields are available later when you define the Word template. Only select relationships you need to add CRM data to the Word template.
Click Download Template on the Select Entity page to create a Word file on your local computer with the exported entity included as XML data.
Enable the Developer Tab
Open the Word template file. At this point, the document appears to be blank.
Figure 11.0 1
For To see and add CRM XML data, you need to enable the Word Developer tab.
Go to File > Options > Customize Ribbon, and then enable Developer.
Figure 12.0 1
Developer now appears in the Word ribbon.
Figure 13.0 1
You use the XML Mapping Pane to add CRM entity fields to your Word template. Be sure to only add fields as Plain Text or Picture.
Figure 14.0 1
Define the Word template
Use the XML Mapping Pane to define the Word template with CRM entity fields.
- In your Word template, click Developer > XML Mapping Pane
Figure 15.0 1
The default XML schema is selected.
- Select the CRM XML schema. It will begin with “urn:microsoft-crm/document-template/”.
Figure 16.0 1
- Expand the CRM entity, right-click the entity field, and then clickInsert Content Control > Plain Text.
Figure 17.0 1
The CRM entity field is added to the Word template. Add additional entity fields, add descriptive labels and text, and format the document.
A completed template might look like this:
Figure 18.0 1
Some content control fields you entered likely have multiple lines of data. For example, accounts have more than one contact. To include all the data in your Word template, set the content control field to repeat.
Set content control fields to repeat
- Put fields with repeating data in a table row.
- Select the entire table row in the template.
- In the XML Mapping Pane, right-click the relationship containing the content control fields, and then click.
Figure 19.0 1
When you use the Word template in CRM to create a document, the table will populate with multiple rows of data.
When the template has the fields and formatting you want, save it and upload it into CRM.
Upload the Word template back into CRM
When you have your Word template built the way you want, save it so you can upload it into CRM.
To use the Word template you’ve created, do the following:
- Open a record with information you want to create a document. For example, open a customer account record in Sales.
- ClickMore (…) > Word Templates, and then under Word Templates select the template you created.
Once generated, documents can be downloaded and then printed, shared, emailed or collaborated on with Microsoft Office 365
Liked it? Share it.