I am creating a series of blog posts that collectively are designed to help anyone preparing for the Microsoft Dynamics 365 Customer Engagement Core exam. (aka MB-200) In this post I will look at concepts around Word templates.
You can see below that we have a section of the exam which covers managing the user experience. Within this section needing to know how to create word templates is referenced.
Overview
As with Excel we can use Microsoft Word templates with Dynamics 365. Templates allow us to create documents containing Dynamics 365 data that follow a consistent format. It will be a common requirement to use Word templates to deliver standard business documents, such as quotes, orders and invoices.
Out Of The Box Templates
One thing that is worth knowing is that Dynamics 365 ships with several Word templates of the box. These include;
- Opportunity Summary
- Campaign Summary
- Case Summary
- Invoice
- Account Summary
- And more …
Tip:
You can view the available templates by navigating to Advanced Settings and then Templates. Within the templates option you will find the document templates option. In here you will find a number of Excel and Word templates.
You can see below that I have opened one of these system templates, notice that I can enable it for specific roles as required. It is therefore possible to grant / restrict access to word templates based on role.
Using these out of the box templates is simple. Just navigate to the required entity, select (or open) a record and select the word template option. Below you can see that I have navigated to invoices, selected an invoice and then I have access to the invoice template in the “Word Templates” option.
Tip:
Above I selected a word template from a view of invoices. It is also possible to find the same option from within the invoice form. (As shown below.)
As part of your revision I suggest running some of these out of the box templates. You may decide the formatting on them isn’t fantastic! And when you do you’ll want to create your own templates.
Word Settings
Before you think about creating Word templates there are some settings you need to check within Word.
On a blank document in word, you will first want to enable the Word developer tools, so that they show in your command ribbon in Word. To do this in you document right click on the existing ribbon. (Maybe within a blank area of your ribbon!)
You can see below that I can now access an option to customize the ribbon.
To enable the developer tools simply tick the developer option and then click OK.
You will now have this developer ribbon within Word.
You are now ready to create Word templates within Dynamics 365.
Creating Personal Word Templates
To create a word template click on the word templates option and then select “Download Template”
When creating a template we first select the primary entity. We can then define what related data we require. For example on a quotation template I might want to show product information and other related data. In my example below you can see that I have selected additional related data for each of the relationship types. Those being 1 to many (1:n), many to 1 (n:1) and many to many (n:n).
To explain my example, each quote can have many quote lines (1:n), each quote can have one account (n:1) and each contact can have many quotes and each quote can have many contacts (n:n).
You can now open the template in Word. But before you can edit the template you will need to click, the “Enable Editing” button.
You can now start to build your document. Obviously the formatting could take some time and involves your Word skills. I am not trying to teach you Word in this post! So I will focus on explaining how to add the data from Dynamics 365 into your Word template. You add fields from the XML Mapping Pane within developer tools.
When you have opened the XNL Mapping Pane you will need to select the correct custom XML part. Using the dropdown you will find the name of the template you have opened. (Clue, it will have “crm” in the name!)
From here I can now open my quote entity to view all of the fields on the quotation.
Additionally scrolling down to the bottom will enable me to see and open the related data I included in my template. Here I can access further details from the account, quote lines and contacts.
To insert fields into your template, simply click on the area of your document that needs to contact the field. Then right click on the required field name. Select “Insert Content Control”. Finally you need to pick the content type, which is typically going to be “Plan Text”.
You may want “repeating” content such as product lines on a quote. To achieve this you first insert the fields required on your quote. (Typically in a row within a table). Next highlight those details fields and navigate to the entity relationship name in the XML content pane. In this example that would be “Quote Lines”. The right click and select “Insert Content Control” and select the “Repeating” option.
Once you have completed all your formatting save the Word document ready to be imported back into Dynamics 365. In Dynamics 365 select the “Word Templates” option again. Then select “Word Template” and use the Upload option to import your file.
Now back in my quotation I have a new personal template. (I will discuss a concept of system templates in a second)
On second (or maybe third) attempt my quotation looked like the one shown below.
My quotation still isn’t perfect but I wouldn’t expect my first (or second) attempt to be perfect!!
Which leads me to a top tip …. You may want to delete this personal template, alter your word document and import a new version. Use the “view all my templates” option to see and manage your personal templates.
Within this option you can manage your templates, including downloading the template and deleting them. I will often repeatedly download, delete and re-uploaded amend templates!
Creating System Word Templates
System administrators and system customizers can create system Word templates. So far I have only mentioned personal templates which could be created by users with the required permissions. But it maybe common that you’ll want to create a personal template and once happy upload it as a system wide template.
In the settings, templates options developers can select the document templates option.
Here the developer can use the “UPLOAD TEMPLATE” option in a very similar manner to that we’ve already seen with personal templates.
Tip:
The resulting template will be enabled for all security roles. So at this point the developer may need to amend the enabled roles.
Having uploaded my template you can now see that my “Example Quote” template is available as a Word Template. Notice that I had also previously uploaded it as a personal template and is therefore showing twice. This is actually something I commonly do! As a developer I create a personal template and only once I am happy do I upload it as a system template. If I follow this approach I would now use advanced find to delete my personal template as it is no longer needed.
Within Dynamics 365 we can use solutions to move the assets in our application from instance to instance BUT I would like you to appreciate that document templates are not solution aware. Meaning they cannot be added to a solution. Therefore, if you have multiple instances of Dynamics 365 the templates would need to be manually imported into each.
I hope this post has given you a good overview of Word Templates and covered the key information you’ll need to revise for the MB 200 exam.