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:
Solved! Go to Solution.
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:
formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
End Time set to following formula:
formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')
@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')))
@empty(body('Filter_array'))
Image reference;
Best regards,
Kris
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:
formatDateTime(utcNow(),'yyyy-MM-ddT00:00:00Z')
End Time set to following formula:
formatDateTime(utcNow(),'yyyy-MM-ddT23:59:00Z')
@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')))
@empty(body('Filter_array'))
Image reference;
Best regards,
Kris
This worked just as I wanted, thanks!
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.