Design a site like this with WordPress.com
Get started

Power Automate – Set the correct timezone on Date fields

With the previous versions of D365 CE where a background process could be used to set up automatic task based on a business trigger, the system would respect CE’s Timezone while setting the “Due date” on the task.

For example, if there is a business requirement to set up a “Follow up task” based on some event to (e.g., When Follow up required = Yes) to be Due in X days from today, when the CE’s background process executes it will put the “Due date” on the task to be X days as per the current configured/set timezone on CE.

However, in the new world of Power Automate all things are pursued and executed in the UTC timezone. There is no concept of a particular system time it can adhere to and hence it is rather a tricky thing to spot it but fairly easy to fix it.

So in my first ever blog post, I am going to discuss and talk about how to go about setting up a Due date while setting up an automated task in the correct timezone.

Scenario

On my entity, when “Follow up required” (a Boolean field) = Yes, then set up a Task with Due date to be 14 days from today.

Initial Solution

Following my natural instincts, the straight forward way of setting up the Due date would be something like this:

But this will not work (or did not work for me) as my Timezone was very different from UTC and hence the tasks coming out from this Flow were having Due dates a day earlier (depending on when the flow gets executed).

Correct solution

So, to ensure that for a Task to not have an incorrect “Due date”, we should use an OOtB Power Automate action “Convert Timezone” which looks something like below:

The “Action” once added would require four parameters, namely:

  1. Base time: The time that you want to convert – the Follow-up date from the entity record.
  2. Format string: There are a variety of options and if unless you know for a fact the exact date time format is for all the users within the system, select the simplest one which works for all “Universal sortable date/time pattern – 2009-06-15 13:45:30Z [u]”. This is how SQL stores the formatted string.
  3. Source time zone: Select it to be UTC
  4. Destination time zone: Timezone for the target CE instance

Once the above is done, rest is simple – select the “Converted time” instead of the original field while creating Task as follows:

Hope it helps!

Advertisement

2 thoughts on “Power Automate – Set the correct timezone on Date fields

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: