So you just want Flow running in business hours, 8am to 5pm

Here is a little helper I use when creating flows that I only want running during business hours only.

Let’s say we generate an hourly email that goes to shared mailbox. There are times when this email is pointless after 6pm or before 8am (per say). There are times when there is no need to have this email outwith Monday to Friday so here is an easy way to handle that.

Return true if after 8am but before 5pm

@and(greaterOrEquals(formatDateTime(utcnow(),’HH:mm’), ’08:00′), lessOrEquals(formatDateTime(utcnow(),’HH:mm’), ’17:00′))

Return true if not Saturday or Sunday

@and(not(equals(formatDateTime(utcnow(),’dddd’), ‘Saturday’)), not(equals(formatDateTime(utcnow(),’dddd’), ‘Sunday’)))

When either of the above returns false I like to the Terminate action to complete Flow as a success.

Both of the above conditions have the same Terminate action with in. So once you satisfy the conditions the Flow can now push on and do something useful.

If this post helps you, please help the community by clicking thumbs up.

Alan

 

Related Post

PowerShell Office 365: SMTP Email Sent with PowerS... In this example, I have an extremely simple function called MyCode. The purpose of the function is only to demonstrate us taking any PowerShell output...
Call Office 365 Service Communications API and Ret... Here is how I have managed to return the latest Service Health alert (only) from Office 365 "Office 365 Service Communications API". Office 365 New S...
Call Office 365 Service Communications API and Ret... In part 5, we will now look to create the flow that will populate the nested folder called O365 Notices. More information on the folder structure in p...
Call Office 365 Service Communications API and Ret... In part 4, we will now look to create the flow that will populate the nested folder called Live Updates. More information on the folder structure in p...