Decline meeting request with Power Automate

The blog is dedicated to a community friend, Matt, who had an issue & was keen to check if Power Automate could resolve that. He was kind enough to attend the Cape Town meetup session where I talked about a similar concept.

You can check out Cape Town meetup here

Let us understand what was required –

We have all seen MyAnalytics helping us all in setting up Focus time during the work-week. We all have been leveraging it to complete our work. Unfortunately, some colleagues were still booking meetings for the focus time too. And, If the meeting invite came during focus time, there are chances that you might miss the meeting. So, a need to decline the meeting without deviating from our work came & also without being guilty.

In one line, if meeting time is overlapping with my focus time, decline it.

Also, let me know if this blog helps you too.

Let us see how Power Automate comes to the rescue 😊

My overall flow is described below –

  • It checks for any new event (event could be meeting/appointment) when it’s created, updated, or deleted.
  • It then gets my entire calendar & filters for my Focus time.
  • Then there is a condition to check conflicts/overlaps with Focus time and rejects it

Let us see this in detail now.

Step 1

When you add the trigger for “When an event is added, updated or deleted” make sure to select the correct Calendar id.

Incoming Days tracked – the number of days you want to look for/track for. Here I am only looking for 5 days (including today)

Past Days Tracked – I am not tracking any past day’s meetings. If you are someone who books time for a month ahead this might be helpful for you

Step 2 –

Get your booking for the next 5 days. (Why 5 days? Since I am tracking for 5 days as per Step1)

Select the Calendar id same as Step 1. Start Time would be from now until End time which is next 5 days.

The formula used is –

Start Time – utcNow()

End Time – addDays(utcnow(),5)

Step 3 –

From Step 2 use the value & subject fields to get your Focus time. We are using array as there could be multiple focus time during the day

Note – When Focus time is booked from MyAnalytics, it is an appointment with Subject as Focus time.

Value is a case-sensitive field. So be careful with the typos.

Step 4-

Let us now check for any overlapping time. We will also make use of the Action Type field which informs about a new event or whether the event was updated.

To avoid checking for both events, we will only say Action Type <> deleted. Deleted will only come if a meeting was canceled & we also don’t want to look for those meetings.

Start time of the event is greater than or equal to Focus Start time

Start time of the event is less than End time.

Here we have left start time is less than or equal to End time is not select as we want to consider the event if its either starting after the focus time or ending before the focus time.

Start time of the event > = Start of the Focus time

Start time of the event < End of the Focus time

Action Type <> deleted

Condition 1 – Happy Path (When you are happily working)

If the condition is satisfied, that means we have an overlapping time of the event with focus, we will go ahead & decline it.

Event Id – is the new event we received which is our trigger. The Id will be a series Id if this is a recurring meeting & needs to be declined.

Note – As a best practice, always add a comment to make the organizer know this was automatically declined.

Condition 1 – Sad Path (When you have to attend meeting)

This would mean that the first part is not satisfied & you have chances to attend the event.

We will now quickly check for another condition for overlap with the event ending time & Focus time.

End time is greater than Focus Start time

End time is less than or equal to End time

End time of meeting > Start time of Focus time

End time of meeting <= End time of Focus time

Action type <> deleted

Condition 2 – Happy Path (When you are happily working)

This would mean there is again overlap with focus time, so we will go ahead & decline it.

Condition 2 – Sad Path (When you have to attend meeting)

This would be your call if you want to automatically accept the meeting later or you can choose to accept the meeting.

Hope this helps!

Keep reading, keep enjoying, keep exploring!

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 )

Google photo

You are commenting using your Google 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