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