How to print current local date and time in Dynamics 365 CRM Word Template

By | September 11, 2019

Introduction

Dynamics 365 CRM word template allows users to make their own standardized entity specific template to represent data according to their business standards.

It is a requirement for businesses today to send quotation of their products or services to their customer. For this they mostly prefer to use Microsoft word template with their own set of standards on which they can create the required quotation against any specific customer easily. However, the quotation must have the current date and time on which it was generated.

We think that this can be very much achieved by making use of Microsoft world macros. But as we have no experience in macros we thought of a workaround option that we can use to show current local date and time on the document generated through word template.

So in this blog, we will show how we can get the current local date & time in word template:

Steps 1 – Go to Customization >> Entities >> Preferred Entity as Quote >> Fields >> New

Dynamics 365 word template

Step 2 – Create a date & time field on the CRM as shown below:

Name: Today’s Date

Data Type: Date and Time

Field Type: Calculated

Behavior: User Local

Format: Date only or Date and Time as per requirement

Next, click Edit button next to calculated field.

Dynamics 365 word template

Step 3 – Calculated field allows us to set the value of field as per the conditions provided but we want today’s date without any conditions. So in the action tab use the NOW() function which will give the current date and time.

Dynamics 365 word template

Step 4 – Download Word Template Settings >> Templates >> Document Templates >> New or Any entity >> Ribbon Button >> Excel Template or follow Microsoft Doc to download Word Template.

Step 5 – Go to the word template downloaded from Dynamics 365 CRM and on the Developer tab (if developer tab is not visible click here) click the XML Mapping Pane.

Step 6 – Place Todays’ Date field on the word template as shown below:

Dynamics 365 word template

Dynamics 365 word template

Step 7 – Upload the word template on CRM and export it from individual record or from home grid or from advanced find record list.

Dynamics 365 word template

Dynamics 365 word template

Dynamics 365 word template

Step 8 – Result.

Dynamics 365 word template

Please note: The format for date & time will be same as in CRM.

Conclusion

In this way, we can create the custom field Today’s date to store the current date and time. So whenever it is exported we will always get the current local date and time.