Personalization is an important aspect of Microsoft Dynamics 365 Finance and Operations. Removing or adding custom fields, setting default filter ranges, and changing the order of fields are some examples that make end users more productive. Next to what is visualized to the user, also the language and date format is helping the user to understand the application and data. In this post, I will talk about the date format and share a small utility to give users more options to manage the format of the date.
Standard date format settings
Let’s first start by looking at the default personalization options for the date format. When deploying a new Dynamics 365 Finance and Operation environment, I usually have a development with a demo database. In this environment, the language of the user defaults to the English (United States) language. Initially, the language also determines the date format which is in this case Month-Day-Year. In the example on the next screenshot, the date is May 9.
As a Dutch, I’m used to working with dates in another sequence which is Day-Month-Year. On the User options form, you can manage the date, time, and number format.
If you change the value in the Language field, it will both change the language and regional preferences for the date, time and number formats. When you don’t want to change the language but would like to have other regional settings, you can select a language value in the field Date, time, and number format. If there is no value filled in this field, it will have a fallback to the Language field for the regional settings. When filling the Date, time, and number format field with the value nl (Dutch), the order of date elements is now switched on all date and date/time fields in the application.
When looking at this particular date and you don’t know what regional setting is used, it would be hard to know if this is a date in May or September.
More options to control date and time format
A recent question on the Dynamics Community triggered me to do some research and come up with a solution. You can read the question and look at the code I shared as a suggested answer. After providing the code, I thought it would be better to make this a personalization option for users. I created a small feature that can be downloaded and used for free.
The file contains a deployable package, model export, and project export. You can choose which option you prefer to import the solution to your environment. If you are not experienced with installing any of these files, you can get help with standard documentation on Microsoft Learn, e.g.:
- Apply updates to cloud environments – Finance & Operations | Dynamics 365 | Microsoft Learn
- Export and import models – Finance & Operations | Dynamics 365 | Microsoft Learn
- Finance and operations project type in Visual Studio – Finance & Operations | Dynamics 365 | Microsoft Learn
In case you are importing the project or model, you would need to build the model and synchronize the database. These two options also provide you with the source code of this feature. When you install the deployable package, you only have the runtime objects and not the source code installed.
In this feature, I provided extensions where a user will be able to manage settings for e.g. Days, Month, and Time format on the User options form.
When a user will open the form for the first time, all values are initialized with the value Auto. When making the settings like the screenshot, the date on any form in Dynamics 365 Finance and Operations will have the next experience.
In my demo, I also changed the time format. This will enforce the time being presented with AM/PM indication.
Note that the date-time personalization will only work on forms in the standard application in case a FormDateControl or FormDateTimeControl is used. When testing the solution, I had seen that the space for the date separator is not resulting in having the correct separator in the application. As I use default property options, I was not able to find a solution for this.
The source code comes with the next objects:
|Table||The DynPed_UserDateTimePersonalization table contains date time personalization settings for each user.||DynPed_UserDateTimePersonalization|
|Form extension||Extension of the SysUserSetup form. Added the table as datasource and an additional tab section with the date and time personalization fields.||SysUserSetup.DynamicspediaDateTimePersonalization|
|Class||Extends the class FormRun to manage date and time format settings.||DynPed_FormRun_Extension|
|Class||Subscribes to the onDeleted event from the UserInfo table to delete a record in the DynPed_UserDateTimePersonalizaiton in case a user gets removed.||DynPed_UserInfoEventHandler|
|Label file||DynPed_UserDateTimePersonalization_en-US||User interface text elements for the feature. Only English (United States) labels are provided.|
The actual work is done in the class DynPed_FormRun_Extension. First, it gets all controls defined on the form. While looping all these controls, it will check if it is a FormDateControl or FormDateTimeControl. In that case, properties to manage the visibility of the control are changed on runtime only.
I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.
That’s all for now. Till next time!
What about your solution for the HR modules, including the whole employment part that mixes date formats and works in UTC format in the database.
Many customers do not see the need to manage hours. I hire a new employee on 05/05/23 and he finishes 30/06/23. In practice even his employment contract is governed like that without the hours.
Thank you in advance for your feedback on this subject.
This is a great question. There are properties on FormDateTimeControl elements to hide the hours, minutes, and seconds separately. As the feature is affecting all controls throughout the application, regardless if it is Human Resources related or not, I have skipped making these configurable in this demo. However the employment will be treated on the date level, the time is important in case you want to view or manage historical changes to these records. I would recommend extending the forms by adding controls showing the date only for the users where this is applicable.
If you really need it, it would be possible to change my shared coding and add the option to manage the visibility for hours, minutes, and seconds.