With Microsoft Dynamics 365, users can now automatically generate Word and Excel documents directly from Dynamics 365. This allows documents to be automatically merged, without the need to perform a mail merge or to create custom reports. Documents such as letters, quotes, invoices, delivery notes and other documents can now be created with a single click.

Document Templates

In the new release of Dynamics 365 in 2016, there is easy to use template design process, allowing users to build document templates from the entities (e.g. Contact, Account etc), that are defined in 365. In Dynamics 365 the user can select the main entity they would like to use and any other entities that are directly related to it. Multiple related entities can be selected for different types of relationships. It should be noted that in this initial release that only one level of related entities can be included.

The document template design process uses the XML mapping pane in Word and Excel. The mapping pane allows CRM fields from selected entities to be inserted into the document templates. For example, fields such as the contact’s name, address, product information, purchase reference numbers etc. can easily be placed into an Order template. This is illustrated below:

Document Generation

Once the document template has been created it will be available from the menus for the selected entity type e.g. Order, Invoice etc. From a record, the user can then select the template to be used to generate a document. This is illustrated in the example below:

Create a Template

1. The first thing we need to do is create a template. To create a template, navigate first to the template section of Dynamics CRM.

2. Next, create a NEW template.

When we click on the +NEW button, a pop-up will appear. In this window, we can select which type of document we want to create a template for. Notice here that we now have Microsoft Excel as a document type as well as the standard Microsoft Word document type.

For the purpose of this demonstration, let’s select Microsoft Word. Additionally, we have an option to select the Dynamics CRM entity the document will be related to. Let’s select Account in the “Filter by entity” field.

We can now select the criteria for the data fields that will be used within this document. You can decide which relationships you want to include for your document. We have selected all for this demonstration. Then click Download Template.

Based on your browser settings, you may or may not see a download prompt. If you do see the download prompt, it may look similar to the image below. If you do not get the prompt, navigate to your default download folder to find the template.

Once the template is opened, you should see something like the image below. If you do not see the DEVELOPER tab, complete the steps below. If you do see the DEVELOPER tab, you can skip those instructions and move on to the next set of steps.

To enable the DEVELOPER tab, follow these steps:

1. Click FILE.

2. Click OPTIONS.

3. Click the Customize Ribbon.

4. Click the checkbox for the Developer tab.

5. Click OK. You should now see the DEVELOPER tab.

6. On the DEVELOPER tab, select XML Mapping Pane. This will open a pane to the right. There is a drop-down menu where we can select the template. Select the option that looks something like urn:microsoft-crm/document-template/account/1/.

Once selected, the entity name, Account, will be displayed, and when we expand the caret the available field names will be shown. Note: this will only display the schema names for the fields.

To add a data field to your document, follow these steps:

1. Move the cursor in your document to the correct place for the data field.

2. Navigate to the XML Mapping pane and find the desired field to add to the document.

3. Right-click on the field. A pop-up will be displayed named Insert Content Control.

4. Select the content type for the data field.

5. Once selected, the data field will be displayed within the document.

6. Add additional data fields to the document as necessary.

Once you have finished designing the template, save, then upload it to CRM.

To upload a template to Dynamics CRM, follow these steps:

1. Navigate to the Templates section in Dynamics CRM.

2. Click Upload Template. This will display a pop-up window.

3. Upload the file either by dragging it on to the pop-up window directly or through browsing.

4. Click Upload.

There you have it! You can now utilize this document template for creating documents!