cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (42,033)