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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,011)