*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***

I love finding out simple things in Dynamics 365, things that you never had any need for but once you find out how easy it is, you question how you didn’t know it before. I found one of those things recently when working on a proof of concept for a client where we needed a way of converting time zone fields to make sure appointment ics files were sent in the correct timezone for the recipient. If you know already then kudos to you, if not, this is the easiest thing in the world! In this example I will use a case record with a next response date and time field that can be used to update the client on when to expect a follow up. Quick and simple, let’s go!

First, how do we add a dropdown list of all time zones? I incorrectly assumed there must be a global choice field being used already that I could just use. I was totally wrong, it’s even easier than that. Add a new field to your table and select Whole number as the data type. Now we have a beautiful format option of Time zone.

Click to view in detail

After adding the field to my case form, I can then see a list of all time zones to select from.

Click to view in detail

In my example, we can set the time zone for the case, which could indicate where the customer is located. The date field below it can then be selected by the user as to when THEY will be sharing the next response or follow up and not need to worry about what time that will be for the client. It also doesn’t matter what time zone they have in their personal settings as all date/time fields are stored in the database as UTC (Coordinated Universal Time). We can then use that knowledge and combine with the Case Timezone to convert the date and time to send to the customer.

Click to view in detail

You can start your flow however you need to, but there are two steps you will need to get the date field and share it with the customer in ‘their’ time zone. First is the Dataverse List rows action. There is a table named Time Zone Definitions where records have a timezonecode field. Each timezone has a numeric value, which then should make it less surprising that we can add a time zone field as a Whole Number. Eastern Standard Time for example is 35. Western Europe Standard Time (UTC+1) is 110. Use the filter rows value and add the following but replace with your actual field that you will need to get from a previous step in your flow.

(timezonecode eq YOUR-TIMEZONE-FIELD)
Click to view in detail

Now use one of the standard actions called Convert time zone. We will take the date/time field for Next Response on the case, determine how we want it formatted, set UTC as the source time, and use the row we found in our step above to set the destination time zone. If you name your list rows step the same as mine, you can just copy and paste from below. It is the standardname value from the Time Zone Definitions table that we need.

@first(body('List_rows_|_Find_Time_Zone')?['value'])?['standardname']
Click to view in detail

Now you can use the output from your Convert time zone step in an email or anywhere you need it to show the date/time value to match the timezone on your record. Here we can see the original date and time picked where the user was in UTC + 1 (3 PM – such as Amsterdam), but the value is stored in the database as UTC (2 PM), and it is converted in to UTC -5 (9 AM – such as Atlanta). So the time difference is 5 hours. So not all that difficult to do!

Click to view in detail

This is just 1 of 476 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.




Leave a Reply

Your email address will not be published. Required fields are marked *