Home > CRM > [Dynamics CE] Configure and automate Document Template generation

[Dynamics CE] Configure and automate Document Template generation

In this article, lets see how to configure ‘Document Template’ on ‘Contact’ entity and automate the template the generation using OOB ‘SetWordTemplate‘ Action from  a Workflow.

Configuring ‘Document Template’:

  • Form Dynamics application, navigate to ‘Settings -> Templates -> Document Templates’.
  • Create a new Template and choose ‘Filter by entity’ as ‘Contact’.


  • Click on ‘Select Entity’.
  • In the next screen, select the Relationships, if you need to render related entity data in the Template.


  • Click ‘Download Template’
  • Save and Open the downloaded word document.
  • From word Ribbon, Click on ‘Developer’ tab, ‘XML Mapping’ and from the drop down, select the option as below:


  • Next compose the content and add the Contact/Related entity fields as required.
  • Save the document and its time to upload the configured Template.
  • Form ‘Settings -> Templates -> Document Templates’, click on ‘UPLOAD TEMPLATE’
  • Click ‘browse’ and attach the configured Word Template.


  • Click ‘Upload’
  • In the next screen, you can change the ‘Name’ and ‘Description’ and click ‘Save’


Generate Document Template Manually:

As we completed the ‘Document Template’ configuration, now lets see how to manually generate the ‘Document Template’

  • Open the Contact record.
  • From the menu, select ‘Word Templates’ and pick our Template from the list.


  • Application will generate a Word Document as below:


Automate Document Template Generation:

Sometimes we would need to generate the ‘Document Template’ , based on the business rules. As an example, If a ‘Contact’ record created with ‘Company Name’ field, generate the Document Template. Below are the steps to automate using ‘Workflows’

  • Navigate to Settings -> Processes
  • Create a new ‘Workflow’ by selecting ‘Contact’ as Entity.


  • Under the ‘Steps’ section, select ‘Perform Action’


  • Select ‘SetWordTemplate‘ action and click on ‘Set Properties’ and map our ‘Word Template’, as shown below.


  • Activate the Workflow.

Test the automated Document Template Generation:

You can invoke this workflow based on your business requirements. You can also configure this as ‘Child process’ and trigger from other workflows.

For this article, lets trigger this as ‘On-demand Workflow’

  • Open the ‘Contact’ record.
  • From the sitemap menu, click on ‘Run Workflow’ and run the ‘Workflow’ as below


  • Refresh the Contact record and under ‘Notes’ tab, you should see the generated ‘Word Document’. Note that, as its a “Background Workflow”, the process may take few seconds.



  • “Document Templates’ cannot be included in Solutions to move to other environments.
  • Use Document Templates Mover tool to move templates to other environments.
  • This tool keeps the ‘Document Template’ GUID constant across the environments which means you don’t need fix the workflow’s with ‘Document Template’ lookup resolution issues.





  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

%d bloggers like this: