Search This Blog

Tuesday, May 2, 2023

Introduction to Behaviours of Date and Time Fields in Dynamics 365

 In Microsoft Dynamics 365, the “Date and Time” data type is used quite often. Based on the requirements, we have the options to choose the format between “Date Only” and “Date and Time”. But what matters the most is the accuracy of information being generated from the data, and this has been an issue in old versions of Dynamics CRMs.

For example, the “Date of Birth” field is used commonly in many organisations with the “Date Only” format, and some organisations use the same instance of Dynamics CRM in different time zones.  If a user enters 21-2-2017 in the “Date of Birth” field for a record from their CRM account with time zone of Auckland (GMT +12:00), then if the same record is being viewed with a different time zone such as Tokyo (GMT +9:00), it would display 20-2-2017 (one day behind).

This is because when the record was saved by the first user, its time element had the value set to 12:00 AM, and when the record is being viewed in Japanese time zone, the time is converted to 20-2-2017 8:00 PM. Therefore, the value is shown as 20-2-17.

Fortunately, in Dynamics 365 we can select the behaviour for Date Time fields. In this blog, I will walk through the differences between these behaviours.

User Local

The field values are stored in UTC time zone. However, the values being displayed to the user depends upon the time zone selected in user’s Dynamics 365 application. For example, I created a custom field called “Interview On” of “Data and Time” data type for the Contact entity. Following were the options selected in the “Type” section.

image

Once saved, I added the field onto the Contact main form. Then a new record was created by a user in New Zealand and a value was selected for the “Interview On” field.

image

After the changes were made, another user from Japan opened the same record, but would see a different value than the one stored earlier.

image

Even though the “Interview On” value in the database for this record hasn’t changed at all, the time being displayed in the CRM UI is different. This is because the value displayed to the user depends on their time zone.

Date Only

The field value doesn’t display any time, but only date. In the database, the time portion of the value stored is always 12:00 AM. The advantage of using this behaviour is that date value is displayed the same across all time zones. This behaviour is useful for fields such as “Date of Birth” because no time conversion will be done, and accurate information will be presented to the user every time.

I created a custom field called “Date of Birth” for a custom entity called “Pet”, with following options selected in “Type" section.

image

Once saved, I added the field onto the contact main form. Then a user from New Zealand selected a date of birth for one of the Contact records.

image

When the same record was opened by another user in Japan and date values were being displayed the same for the “Date of Birth” field.

Time-Zone Independent

The last behaviour type is “Time-Zone Independent”. When fields with format of “Date and Time” are set with behaviour “Time-Zone Independent”, the values are displayed the same across all the time zones. For example, I modified the behaviour of the field I recently created “Interview On”. I changed the behaviour to “Time-Zone Independent”. Following are the values that were set in “Type” section.

image

Note: Once the behaviour is set to “Time-Zone Independent”, it cannot be changed.

image

Once the changes were saved, user from New Zealand created a new Contact record and selected a value for “Interview On” field.

image

Then the record was reopened by another user in Japan. However, the values displayed in field “Interview On” was still the same for this user too.

Conclusions

There are a few things we must keep in mind. Out of the box field’s behaviour can be set to “Date Only” from “User Local”, but this cannot be done for all out of the box fields. Such as, “Original Start Date” field for Appointment entity is a field of type “Data and Time” and has behaviour set to “User Local”, and this cannot be changed. Also for a custom field, we can change the behaviour from “User Local” to “Time-Zone Independent” or “Date Only”.

Having the option to select either one of these behaviours saves us lots of additional coding time. For example, one of our clients had users from different time zones who were using same instance of CRM 2011. They used a field of format “Date Only”. Since data was being viewed in two different time zones, many records were displaying incorrect date in one of the time zones. There was no option to change the behaviour.  To come across this issue a lot of coding was required to update existing records, and automatically update future records.


Understanding organization’s base currency in Dynamics 365 (CRM)

Introduction

In this blog, I have explained what should be the base currency of an organization and what problems you may encounter if you do mistakes in selecting it.

What is organization’s base currency?

Organization’s base currency is the currency which is selected at the time of installing D365 On-Premise or while configuring D365 Online.

Where currency is used?

All entities in CRM have a lookup reference to Currency entity. This lookup reference determines the currency in which all the Currency type fields should be captured for a record. E.g. On opportunity record, we have a lookup to Currency entity i.e. we select currency on the opportunity record. So based on selecting the currency on opportunity all its currency fields like Est. Revenue, Total Amount, Discounts are captured.

What is _base field which gets created for each currency type field?

If you have observed, when we create a field of type Currency, its corresponding _base field is created automatically by CRM. This field always gets calculated in Organization’s base currency.

How multiple currencies work and how the exchanges rates are applied?

When you install the CRM, by default it enables only single currency which is considered as organization’s base currency. The Exchange rate of Base Currency is set to 1 and we cannot change it.

When we add new currency (from Setting > Business Management > Currencies), we select the currency code and put Exchange rates which are corresponding to the base currency. These exchange rates are used later while calculating base amounts.

How to capture/update exchange rates and how it impacts existing records?

Exchanges rates in CRM are not captured automatically. You will need to manually put exchange rates either at the time of enabling currency or update it later in existing currencies.

When we update exchange rates in CRM, it does not apply to existing amounts of the existing records. When any amount field gets updated on existing records, the updated exchange rates are used to calculate base values.

Understand with examples

Let’s say, we have below setup in our CRM Environment.

Organization Currency: US Dollar (USD)

Additional Currencies:

  1. Indian Rupees (INR) with Exchange Rate: 1 USD = 68.03 INR
  2. Australian Dollar (AUD) with Exchange Rate: 1 USD = 1.39 AUD

Below table contains examples of quote records with different combinations of currencies.

Quote IDCurrency selected on recordTotal Amount

(captured using currency selected on record)

Total Amount _Base

(captured using organization’s currency)

DLKJ548INRINR 158900USD 2336.18
KEIK902USDUSD 59800USD 59800
PELJI7453AUDAUD 6500USD 4681.88

 

Unforeseen problems which might occur later

  1. Organization’s base currency can be selected only at the installation/configuration time of CRM. We cannot change base currency once CRM is installed/configured.
  2. Sales goals are always captured in organization’s base currency. We cannot change currency on Sales Goal record.
  3. If you select base currency incorrectly, then for reporting purposes, you might always need to convert the amounts in your currency using exchange rates.

Case studies

Case 1

Contoso is Indian company which works on Indian Rupees currency. All the clients of this company are Indian clients and they don’t have any other clients from other countries.

Solution: In this case, only single currency is needed which will be organization’s base currency i.e. Indian Rupees (INR).

Case 2

Contoso is Indian company which works on Indian Rupees currency. This company has clients across globe like US, Australia, New Zealand etc. The company has 85% clients from US and remaining 15% customers are distributed among other countries.

Solution: Even though, the company has 85% customers from US, and no customers from India, the company works on Indian Rupees currency. Hence, the organization’s base currency should be set to Indian Rupees (INR) and additionally USD, AUD, NZD currencies should be enabled with their respective exchange rates.

Case 3

Contoso is Indian company which works on US Dollar currency. This company has clients across globe like US, Australia, New Zealand, and India etc. The company has 85% clients from India and remaining 15% customers are distributed among other countries.

Solution: Even though, the company is Indian company and has 85% customers from India, the company works on US Dollar currency. Hence, the organization’s base currency should be set to US Dollar (USD) and additionally INR, AUD, NZD currencies should be enabled with their respective exchange rates.


How To Configure Currencies In Microsoft Dynamics 365

 In current business scenarios, it is very common for companies to trade across different countries. Handling transactions in more than one currency is required more than ever before.


With Dynamics 365, you select a base currency while setting up an environment. This base (default) currency cannot be changed.


However, you can add additional currencies.


For example, the base currency is USD; we can add another currency say, INR. Then we need to define the currency conversion (as shown below):

Currencies can be configured under Advanced Settings, Settings -> Business Management -> Currencies.

OR open Power Platform Admin Center (https://admin.powerplatform.microsoft.com/environments), select the required Environment, 

click Settings, and click Currencies under Business.

Users can see the list of active currencies and also can create and edit them.

Users can define the currency conversion of the currency with the base currency of the organization. Along with currency conversion, it is possible to change the Currency Name, Currency Precision, and Currency Symbol.

If users don’t find currency in the Active Currencies view, then they can ask the Administrator to add the new currency. 


Click New and then select Currency Code (where Currency Type is System).

Select the required system currency and click OK.

Enter the details of the new currency, including the Currency Conversion about the base currency. Save the record.

If Administrators don’t find the currency in the lookup record, they can create a custom currency. Examples of such currencies can be Bitcoin, Ripple, etc.

Other important details of Currencies:


When users select a currency other than the base currency for any transaction, the system automatically converts the selected currency value to base currency in money (base) field. For example: 


The money field name is Proposed Amount.


The base currency is USD ($), and the transaction currency is INR (₹)


Transaction is:


Currency selected: INR

Proposed Amount: ₹ 1,000

Proposed Amount (Base): $ 15.02650* – This field is automatically created.


*1 USD = INR 66.5495 


If the administrator changes the exchange rate for a currency, it does not impact existing financial transactions. But new transactions will use the modified exchange rate.


When the exchange rate of the currency is changed, it is updated on an opportunity only when the user changes the currency field value (example, Est. Revenue field value), and the system will automatically pick new rates.


Currency Display Options


If you want all users to see currency code instead of currency symbol in transactions, the system administrator can change the currency display options under System Settings, General tab(applicable to all the users in the organization).


The available options are the Currency Symbol and Currency Code.

When you select the display option as Currency Code, all users will see the currency code beside the amount. In this example, it is USD.

Default Currency (Personal Options)


Users can change their default currency from Personalization Settings (Personal Options). So, whenever they create a new transaction, the new default currency will be selected by default.It applies only to the user who has changed it, and other users will not have any impact.


Click Settings -> Personalization Settings.

Users can select default currency as per their requirements and click OK.

Now, when a user creates a new lead or opportunity or any other sales transaction, 

the default currency will be select as Pound Sterling (in this scenario). Users can manually change the currency.