cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Running get events v2 and finding out if that event is ongoing

We have a scenario with three people that are on call with a weekly rolling schedule and one common calendar that have all the events and if they are an atendee or not. Each day normally has two events, I have solved the issue with fetching attendees and getting their mobile phone numbers for sending SMS if there are unread messages. But this scenario with sending SMS should only occur if this event that Im checking is currently on going and active. I run the flow every 15mins and say for example I have an event that is active 17:00-23:00 I only want to have my action being triggered if the current time is within that interval. 

 

Im currently working with Get calendar view of events and filtering on 24h and Im then retrieving the two events that take place each day. I try to run an apply to each and compare start and end times against utcnow. I think I may be doing this wrong, can I perhaps do the filtering already in the Get calendar view of events? 

 

Im attaching some screenshots:

calendar.PNGrest.PNGrest1.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @E_G,

 

Does your flow run successfullly on your side?

Do you want to filter the events within the "Get calendar view of events (V2)" action rather than add a "Apply to each" action within your flow?

 

If you want to filter events within the "Get calendar view of events (V2)" action (check if the current time is between the Start time and the End time of the event), I afraid that there is no way to achieve your needs in Microsoft Flow currently. 

 

You could consider take a try to add a "Filter array" action to filter the events to check if the current time is between the Start time and the End time of the event. I have made a test on my side on my side and please take a try with the following workaround:

  • Add a "Recurrence" trigger, Interval set to 15 and Frequency set to Minute.
  • Add a "Get calendar view of events (V2)" action, specify Calendar Id, Start Time set to following formula:
formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')

End Time set to following formula:

formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')
  • Add a "Filter array" action, click "Edit in advanced mode", type the following formula:
@and(lessOrEquals(formatDateTime(item()?['Start'], 'HH:mm:ss'), formatDateTime(utcNow(), 'HH:mm:ss')),greaterOrEquals(formatDateTime(item()?['End'], 'HH:mm:ss'), formatDateTime(utcNow(), 'HH:mm:ss')))
  • Add a Condition, click "Edit in advanced mode", type the following formula:
@empty(body('Filter_array'))
  • Within "If/no" branch of Condition, add your extra actions (e.g. Fetching attendees and getting their mobile phone numbers, then sending SMS message). 

Image reference;
1.JPG

 

2.JPG

 

 

Best regards,

Kris 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Hi @E_G,

 

Does your flow run successfullly on your side?

Do you want to filter the events within the "Get calendar view of events (V2)" action rather than add a "Apply to each" action within your flow?

 

If you want to filter events within the "Get calendar view of events (V2)" action (check if the current time is between the Start time and the End time of the event), I afraid that there is no way to achieve your needs in Microsoft Flow currently. 

 

You could consider take a try to add a "Filter array" action to filter the events to check if the current time is between the Start time and the End time of the event. I have made a test on my side on my side and please take a try with the following workaround:

  • Add a "Recurrence" trigger, Interval set to 15 and Frequency set to Minute.
  • Add a "Get calendar view of events (V2)" action, specify Calendar Id, Start Time set to following formula:
formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')

End Time set to following formula:

formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')
  • Add a "Filter array" action, click "Edit in advanced mode", type the following formula:
@and(lessOrEquals(formatDateTime(item()?['Start'], 'HH:mm:ss'), formatDateTime(utcNow(), 'HH:mm:ss')),greaterOrEquals(formatDateTime(item()?['End'], 'HH:mm:ss'), formatDateTime(utcNow(), 'HH:mm:ss')))
  • Add a Condition, click "Edit in advanced mode", type the following formula:
@empty(body('Filter_array'))
  • Within "If/no" branch of Condition, add your extra actions (e.g. Fetching attendees and getting their mobile phone numbers, then sending SMS message). 

Image reference;
1.JPG

 

2.JPG

 

 

Best regards,

Kris 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

This worked just as I wanted, thanks!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (10,657)