cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
harish
New Member

Schedule Flow After Hours

Hi, 

We have an application called pagerduty that we use to setup our After-hours alerts. Basically, when we receive an email after-hours it has to be forwarded to a pagerduty email (pagerduty takes care of the alerts after it recieves the email).

As of now, I want to trigger a scheduled flow with 1-minute recurrence. Let's call it After-hours flow.
So this After-hours flow checks for any incoming new emails every 1 minute that we receive and then forward them to pagerduty email. But this flow should only be functioning only after-hours. Now, my problem is to make this 1-minute recurrence flow stop working during business hours (monday-friday 8:30AM to 5:30PM). I'm thinking if there is another flow that I can setup to stop and start this "After-hours" flow based on business hours schedule. 


1 REPLY 1
v-zhos-msft
Solution Sage
Solution Sage

Hi @harish ,

I suggest you add a condition after the 'when a new email arrivers'.

 I have made a test on my side, please take a try with the following workaround:

The Compose action is to get the Received Time of email:

formatDateTime(triggerBody()?['DateTimeReceived'],'HH:mm:ss')

The expressions in Condition are:

1.

dayOfWeek(triggerBody()?['DateTimeReceived'])  is equal to 0, Indicates that the time is Sunday.
2. 
dayOfWeek(triggerBody()?['DateTimeReceived']) is equal to 6, Indicates that the time is Saturday.
3 and 4
greaterOrEquals(outputs('Compose'),'08:30:00')  is equal to false
lessOrEquals(outputs('Compose'),'17:30:00') is equal to false 

Capture3.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,742)