web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom Message (OUTSID...
Power Automate
Unanswered

Custom Message (OUTSIDE OFFICE HOUR & WEEKENDS)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Team,

 

I am trying to create a flow which sends email post working hours and during weekends. So my office hours are from Monday - Friday 1800 - 600 IST. Any email that comes after the working hours or during the weekend must get a customised message.

 

I tried a few following links which discussed on the same lines but I am finding no sucess. I am not saying the below examples are incorrect but it might be that I am not understanding/executing it correctly. Please guide

 

Example 1 - Email does not trigger

Example 2 - The expression is invalid

 

@or(equals(dayofweek(UtcNow()),0),equals(dayofweek(UtcNow()),6),less(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],-6),'HH:mm'),formatDateTime('08:00:00','HH:mm')),greater(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],-6),'HH:mm'),formatDateTime('17:00:00','HH:mm')))

Example 3 - The expression is invalid

 

@and(less(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],-6),'HH:mm'),formatDateTime('06:30:00','HH:mm')),greater(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],-6),'HH:mm'),formatDateTime('17:30:00','HH:mm')))
My attempts to trigger the mail by manually converting UTC time

@greater(substring(triggerBody()?['DateTimeReceived'],11,8), '00:00:00')

@and(greaterOrEquals(substring(triggerBody()?['DateTimeReceived'],11,8), '15:00:00'),lessOrEquals(substring(triggerBody()?['DateTimeReceived'],11,8), '16:00:00'))

@and(greaterOrEquals(substring(triggerBody()?['DateTimeReceived'],11,8), '15:00:00'),lessOrEquals(substring(triggerBody()?['DateTimeReceived'],11,8), '16:00:00'))

@and(greaterOrEquals(float(triggerBody()?['DateTimeReceived']), '15:00:00'),lessOrEquals(float(triggerBody()?['DateTimeReceived']), '17:00:00'))

Regards

 

Sam

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,203 Most Valuable Professional on at

    Rather than trying to intercept and respnd t individual emails why not write a couple recurrence triggered Flows to enable and disable you Out of Office message automatically?  That way the OOO support in Exchange will take care of all the responses and the recurrence triggers should make it easier to hit the times involved. I believe there is a template that demonstrates how to activate the OOO message from a Flow button trigger.  It shouldn't be difficult to modify that to use a recurrence trigger.

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @Anonymous ,

     

    Please consider the following methods to achieve your needs.

    • Use the formatDateTime() function to get the Hour when the message is received.
    • Initialize array variables to store work hours.
    • Use the dayOfWeek() function to determine if the current date is a weekend, and if so, send a custom message. If not, it is judged whether it is work hours.

    Expression reference:

    formatDateTime(triggerBody()?['receivedDateTime'],'HH')
    dayOfWeek(triggerBody()?['receivedDateTime'])

    Image reference:

    25.PNG26.PNG

     

    Best Regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Barry Cao,

     

    Appreciate your response and I am still testing the flow. I created the flow logic but when an email arrives I see the flow is triggered multiple times and the sender gets  ~10 out of office message. 

     

    Is there something I am doing wrong or can we add a step to avoid me spamming the senders inbox.

     

    Also I just to clarify - I read some articles that the the default time zone in Flow is in UTC so do I need to tweak the time as per my time zone (IST) or convert UTC to IST etc

  • Scami Profile Picture
    2 on at

    Hi have you solved the problem? im struggling to solve it

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard