This article is part of the In Microsoft Dynamics 365 Business Central (Administration), how do I… series and of the wider In Microsoft Dynamics 365 Business Central, how do I… series which I am posting as I familiarise myself with Microsoft Dynamics 365 Business Central.
To create a new Word template there is an assisted setup to guide you through the process. To use this tool, search for and open the Word Templates page.
There are three main stages to the process of creating a Word template; all three parts are covered in this article and the index below will allow you to quickly to a specific section.
- Configure and export the Word template.
- Insert mail merge fields in template using Microsoft Word.
- Import the Word template
Configure and export the Word template
On the Word Templates (9989) page, click the New » Create a template action:
To create a Word Template requires a source table to be available. However, before adding a source table, you need to think about which other related tables you will want to also add to the Word template, as this will decide which table to pick as the source table.
For example, if I wanted to create a letter to customers based on the ship-to address, I cannot use the Customer (18) table as the Ship-to Address (222) table is not a related table. However, if you pick the Ship-to Address table then the Customer table is a related table. This is because tables are available as a related table when their is a field on that table linking it to the other; in the case of the Customer table there is no field for Ship-to Address and so it is not related, but the Ship-to Address table does contain the Customer No. and is therefore a related table.
To add a new source table, click the Add new entity button:
You can either browse or search for the table you want to add; once found, select it and then click OK:
The selected table will be shown in the list; make sure it is selected and click Next:
On the Entities page you will see the selected source table; you can click the b]Number of Selected Fields column to drill in and change the selected fields by adding or removing fields.
To add a second table, click the Add related entity button:
Click the ellipsis button next to the [n]Name[/b] field to select a table:
Only tables which are related to the source table are available for selection; in this case, I have selected Customer and clicked OK:
The Source Entity Relation should usually default in, but the adjacent ellipsis button can be used to change the field which joins the two tables if their is a need.
The Field Prefix will default to the first five characters of the table name, but can be changed if necessary for greater clarity, but is restricted to a maximum of five characters.
Click OK to continue:
Additional tables can be added to the Entities page if required. When all required tables have been added, click Next:
Insert mail merge fields in template using Microsoft Word
To add the mail merge fields to the Word template, click the Download a blank template button and save the downloaded zip file:
Extract all files from the downloaded zip file and open the docx file. When prompted about a SQL command to place data from the database into the document, click Yes
In Microsoft Word, click the Mailings » Insert Merge Field button and select the field t add. You can repeat this as many times as necessary as you write the document:
Once the document is written and all required fields have been added, save and close the Word document.
Import the Word template
Back in Business Central, click Next and then click the Upload the template button:
Either navigate or drag and drop the docx file to upload; confirm the settings are correct and click Next:
Give the uploaded template a Code and [/b]Name[/b] and click Next:
Review the details are correct and click Finish:
The new template will display in the list on the Word Templates page, ready for use:
Word Template Mail Merge in Business Central
In Microsoft Dynamics 365 Business Central, how do I…
In Microsoft Dynamics 365 Business Central (Administration), how do I…
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.