Document creation in MSD 365

Many times we need to create document in MSD CRM and or MSD 365, ex. Quote. In earlier CRM version it was not available out of the box. But as part of MSD CRM 2016 and MSD 365 its has been introduced out of the box, in few clicks we cam create document or automate the process with the help of out of box workflow.  Known issues:- 

1. There is not facility to restrict the data source for this we need to do some work around.

2.  If we try to add more fancy things to the word it might freeze,  Important! A known issue and how to avoid it . If you have frequent accidental edits that cause Word to freeze or have performance degradation, be sure to turn off the AutoCorrect options according to the section.

3. There is an upper limit of 100 for the number of related records returned for each relationship. For example, if you’re exporting a template for an account, and you want to include a list of its contacts, the document will return at most 100 of the account’s contacts.

Well, here are the steps to create and use Word templates in Dynamics 365.

Create a Word template

Navigate to one the below provided place to create the word template in Dynamics 365:

  • From the Settings page. Go to Settings > Templates > Document Templates > New(New or Add button). For this you need System Administrator or System Customizer or proper rights for Document Template and or Personal Document Template.
  • From a record. Templates created from this place will be personal and available only to the user creating the template.
  • From a list of records. For example, go to Sales > Client_Accounts > My Active Accounts. Select a single account, and then click More () > Word Templates > Create Word Template.

    Create a Word template from a Dynamics 365 entity

After clicking Create Word Template, select an entity to filter with, and then click Word Template > Select Entity. ref below image,

Choose Word Template and select entity

The relationship selection page appears, ref below image,

Select entities for 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.

The Word template when first opened

To see and add Dynamics 365 XML data, you need to enable the Word Developer tab.

  1. Go to File > Options > Customize Ribbon, and then enable Developer.

    Add Developer to the Word Ribbon

  2. Click OK.

    Developer now appears in the Word ribbon.

    Developer tool on Word Ribbon


Define the word Word template 

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

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

    Select XML Mapping Pane in the Word ribbon

    The default XML schema is selected.

    The default XML Mapping schema

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

    Select the Dynamics 365 XML schema

  3. Expand the Dynamics 365 entity, right-click the entity field, and then click Insert Content Control > Plain Text.

    Insert the Dynamics 365 field as Plain Text

    The Dynamics 365 entity field is added to the Word template.

    The Dynamics 365 field is inserted into the Word template

    Add additional entity fields, add descriptive labels and text, and format the document.

    A completed template might look like this:

    Sample Word template

    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.

    Create a table and add content control fields

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

    Set the table row to repeating

    When you use the Word template in Dynamics 365 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 Dynamics 365.

Upload created Word document to MSD 365

  1. In Dynamics 365, go to Settings > Templates > Document Templates.
  2. Click Upload Template.
  3. Drag the Word file in the dialog box or browse to the file.

    Upload Template dialog box

  4. Click Upload.

    Non-admin users can upload a template for their own use from a list of records.

another way for non admin users

  1. In Dynamics 365, open a page with a list of records, for example, the list of customer accounts in Sales.
  2. Select a single item such as an account, click More () > Word Templates > Create Word Template.
  3. Click Word Template > Upload.

    Click Upload to bring the template into Dynamics 365

  4. Drag the Word file in the dialog box or browse to the file.
  5. Click Upload.


Generate document from the word template

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. Click More (> Word Templates, and then under Word Templates select the template you created.

    If the template you created is not visible, there are two possibilities:

    1. Only templates built for the selected record type (entity) will be displayed. For example, if you open an opportunity record, you will not see a template you created with the Account entity.
    2. You need to refresh Dynamics 365 to see the template. Either refresh your browser or close and reopen Dynamics 365.

    After you select your Word template, Dynamics 365 creates a Word document from the record you selected.

Try out the sample Word templates

There are five Word templates included with Microsoft Dynamics 365.

These templates are included with Dynamics 365

Using provided sample Word template

  1. Open a record with information with the entity type that matches the sample template. For example, open a customer account record in Sales to apply the Account Summary template.
  2. Click More (> Word Templates, and then under Word Templates select the sample template.

    Open the newly-created Word template and give it a look.


You can review but not edit templates that are included in Microsoft Dynamics 365.

Some more good references for same

  1. Power objects
  2. MSDN docs
  3. Have fun with Excel Template here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s