› Dynamics CRM › Document Generation in Dynamics CRM 2016

Document Generation in Dynamics CRM 2016

 Pankaj Shukla   Leave a comment

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
1

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.
2

Figure 2.0 1
 
Account (Cloudfronts Technologies LLP) Summary template is generated.
3

Figure 3.0 1
 
Open the Account Summary.docx file.
4

Figure 4.0 1
 

Create a new Excel Template

Go to Settings – Templates – Document Templates. Click on +New to launch the wizard.
5

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.
6

Figure 5.0 1
 
To upload a file we need to just drag & drop in the box and click the upload button
7

Figure 6.0 1
 
Once the upload is complete, the template record is displayed.
8

Figure 7.0 1
 
Once you have selected the Template, you also have the ability to set the security roles and control.
9

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.
10

Figure 9.0 1
 
A wizard form opens to provide options in navigating across various entities depending on the relationship types.
11

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.
12

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.
13

Figure 12.0 1
 
Developer now appears in the Word ribbon.
14

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.
15

Figure 14.0 1
 

Define the Word template

Use the XML Mapping Pane to define the Word template with CRM entity fields.

  1. In your Word template, click Developer > XML Mapping Pane
    16

    Figure 15.0 1
     
    The default XML schema is selected.

  2. Select the CRM XML schema. It will begin with “urn:microsoft-crm/document-template/”.
    17

    Figure 16.0 1
     

  3. Expand the CRM entity, right-click the entity field, and then clickInsert Content Control > Plain Text.
    18

    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:
    19

    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

    1. Put fields with repeating data in a table row.
    2. Select the entire table row in the template.
    3. In the XML Mapping Pane, right-click the relationship containing the content control fields, and then click.
      20

      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:

  1. Open a record with information you want to create a document. For example, open a customer account record in Sales.
  2. ClickMore (> Word Templates, and then under Word Templates select the template you created.
    21

     
    Once generated, documents can be downloaded and then printed, shared, emailed or collaborated on with Microsoft Office 365

 


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.