Hello all,
Hope you all doing good during lockdown.
Today I wanted to catchup with you on how we can generate some basic letters (or documents) using word templates in D365 Human Resources. This is also available in D365 Finance and Operations and hence the below walkthrough is applicable for D365FO too.
The biggest advantage of Dynamics 365 stack is its integration with Office 365. There is a feature that exists in D365 where you can define from which entities and fields, you need the data to be displayed in the document (as long as it’s simple). Sometimes HR needs to generate documents such as employment letters, shared parental leave letters or maternity letters etc as part of their processes. Using word templates functionality, this can be acheived and stop there … before you imagine it in a big way, this is strictly for basic templates and I will tell you why.
- We cannot write any joint logic between two entities and hence we cannot make the template to a dynamic document. For example, we cannot display the legal entity’s full name as we can get only short code from the employment entity (ex: we can display “USMF” but not “constoso Entertainment systems”). Another example, system date cannot be added. So for certain details, you cannot rely on data entities. Some needs to be static.
- Since you need to generate the document in the same way you would do export to excel, hence the template should contain the data with root entity only. Example: In worker form, if you want to generate the template based on a selected record, then the root entity should be either worker or employment entity. If the root entity is different, then you cannot see the template option under export to word.
Out-of-box word templates available in D365 HR
Unfortunately, there are not many out-of-box documents that are available – Job template info, performance goals, ADA requirements.
Path: System administration > Office integration > Document templates

Lets say, you want to generate the performance goal document, go to goals form under Employment development module. Open any goal record and click on Office button on top right hand side in order to generate the document.

Document will be generated as per the out-of-box template and you will see something like this:

Now, I will walkthrough you on how to create a simple employment letter.
Design your own template
Go to System administration > Office integration > Excel workbook designer and click on Create blank document.

Download the file and rename it to “Employment letter template”. Now start designing the template as per the format required.

Wherever the yellow fields exist, I will add the fields from the respective data entity. Lets start with the first field “Name” as shown below:

Select the entity from the dropdown and click on next, you will be able to see list of available fields in the selected entity. Select the required field and click Add value. The field placed on left-hand side like a bookmark as shown below:

You can change the font, size or colour as required. You can add the fields from the relative entities too, for example for joining date, I have added employment start date as shown below. For title (or designation), I picked up worker title. As I said earlier, we cannot write any logics or cannot join data entities, where I can use position title instead of worker title.


Likewise, you can try to add any relevant fields you want to display. Once you are done, save and close it.
Tips: If you receive any error with placeholder value that is not getting added, then close and reopen the document. Try to add again. It worked for me.
Load the template in D365 HR (Document templates)
Navigate to System administration > Links > Office integration > Document template. Create a new record and upload the document. You can change the template name to more apt name. You can also see the root entity that will be displayed based on the entities I had selected in the template.

Click on Ok and the template will be saved. There are three filters that are important in this form:

- List in Open in office menu (Showns in Office icon in the respective form/listpage)
- Apply current record (only for the selected record or all records)
- Apply company (only to the current legal entity or all)
Generate the document from the D365 form
Let’s go to the workers list page and open any employee record. Here am opening my record.

Download the file and a document will be downloaded. Here is how it looks:

Similarly, I have tried for leave approval letter, though I was partially successful as I was not able to get all leave dates applied for a particular request.

If you guys already tried out anything on this and if there is a better way of handling this, please let me know.
Happy and safe lockdown!!!
Leave a Reply