cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Out-of-Office Auto Reply - for off hours and weekend

Hey Im building a flow for an automated auto reply email - I have a domain condition(certain emails from specific domains) and then a time condition ( less then 9am and greater then 5pm )- below is an example of my flow. My problem is trying to implement days of week so saturday and sunday will auto reply regardless of hours while monday to friday will have the time received condition. Any help would be great. 

 

Capture.PNGCapture2.PNG

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Anonymous , 

 

Please follow the flow below and add the steps to the if condition in your flow. 

 

outlook.pngExpression for the variable : 

formatDateTime(utcNow(), 'dddd')

This returns the day of the week. 

 

Hope this Helps.

 

Thanks, 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hi @Anonymous , 

 

1. In the weekend if statement, you should change it to Or instead of And (Not related to the time for weekdays but this will not work for weekend condition)

 

2. You are directly comparing the "Recieved Time" field that is an unformatted time string with the hh:mm:ss type string so that is why it is throwing up an error. Follow the screenshot below and the steps to first format the time string and then compare. 

flocal.png

 

Formula for variable: formatDateTime(triggerBody()?['DateTimeReceived'], 'HH:mm')

Hope this Helps. 

 

Thanks, 

 

View solution in original post

25 REPLIES 25

Hi @Anonymous , 

 

Please follow the flow below and add the steps to the if condition in your flow. 

 

outlook.pngExpression for the variable : 

formatDateTime(utcNow(), 'dddd')

This returns the day of the week. 

 

Hope this Helps.

 

Thanks, 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Anonymous
Not applicable

Awesome got it working now. Thanks so much!

Anonymous
Not applicable

Hey just realized my "received time" condition for less then 09:00:00 OR greater then 17:00:00 isnt working correctly now my order of flow is - email arrives > intilialize day variable > Email *Domain Condition* > if Yes *Weekend Condition* - day variable equal to Saturday or day variable equal to Sunday > If Yes Send email > If no *weekday condition* is received time less 09:00:00 OR greater then 17:00:00 if yes send email.  does the day variable effect the time received ?  @yashag2255  any way to fix this problem? thanks

Hi @Anonymous , 

 

Can you please share a screenshot of the flow? I might be able to assist better that way. 

 

 

Thanks, 

 

Anonymous
Not applicable

@yashag2255 yep sorry here is the screenshot says "and" but i have it set to "or" for received time condition. Thanks 

 

capture3.PNGcapture4.PNG

Hi @Anonymous , 

 

1. In the weekend if statement, you should change it to Or instead of And (Not related to the time for weekdays but this will not work for weekend condition)

 

2. You are directly comparing the "Recieved Time" field that is an unformatted time string with the hh:mm:ss type string so that is why it is throwing up an error. Follow the screenshot below and the steps to first format the time string and then compare. 

flocal.png

 

Formula for variable: formatDateTime(triggerBody()?['DateTimeReceived'], 'HH:mm')

Hope this Helps. 

 

Thanks, 

 

Anonymous
Not applicable

@yashag2255 Is there something I have to set the time zone to be correct it seems to be having issues with that. other then thats its working. Thanks very much for taking the time.

Hey!

 

Yep. This takes the UTC time structure by default. 

 

 

Thanks, 

Anonymous
Not applicable

@yashag2255  Okay awesome. I assume I just add my time zone to both variable expressions ? im having trouble finding the right formating for that though if you have a source. 

Hey!

 

Can you share a screenshot? 

 

Thanks,

Anonymous
Not applicable

Hey so i tried a few different things. was attempting to add time zone conversion before the variables but dont know if thats possible? doesnt seem to be working. aslo attempted modifying the variables expressions but not very experienced on how to format them correctly. Capture.PNG

 

Hey!

 

I just checked, Outlook returns the time format in my local time zone. Can you check that once for your account? I am sure it does the same in your case too (provided you have not changed the time zone in outlook. Easy way to confirm would be check any email and if it is your local time then you are good to go without the conversion)

 

Thanks. 

Anonymous
Not applicable

 

Hi @Anonymous , 

 

If you are using Outlook.office.com, please go to mail settings -> and change the timezone so that your emails time accordingly. (please refer to the screenshot below)

outlooktime.png

Similarly, go to the file-> settings and change the tie zone to your current time in Outlook Desktop. 

 

Hope this Helps. 

 

Thanks. 

Anonymous
Not applicable

 

time conversion.PNGI checked both of those to make sure they were good and they are both set correctly, here is a screenshot of the flow display time receiving incorrectly. Thanks for all the help btw.

Hi

Did you fix the time discrepancy?

I have a very similar flow setup and it is 1 hour out

Both set to UTC+0

 

 

 

 

 

 

 

JC80
Frequent Visitor

Thanks again for the great help on this.

 

While looking at your response, I got about 80% of the way, however it was not clear to me where the variable initialization should fall under and where the conditions would get applied. Also, the 'time' variable kept on crashing, so I changed it slightly in order for it to work for me.

 

I ended up putting one variable after the other. 

- Day:  formatDateTime(utcNow(), 'dddd')

- Time: formatDateTime(utcNow(),'HH:00:00')

 

JC80_0-1601496004473.png2020-09-30 16_06_56-Edit your flow _ Power Automate.png2020-09-30 16_04_58-Edit your flow _ Power Automate.png2020-09-30 16_03_29-Edit your flow _ Power Automate.png

 

Then I set the Condition 2 (Weekend email auto reply) and Condition 4 (after hours reply) to identify the domains where the messages would come from. Then under Yes (On both conditions), I added the condition for the weekend days and then on Yes Send the email trigger.  On the other side, I did something similar where I used Condition 3 to filter the time and then Send an Email when those conditions were met.

 
 
 
 
 

I really hope this helps someone else who is looking for the step-by-step as I got stuck here for a while until I was able to figure it out, but the steps provided in this article gave me almost the full answer.

 

 

Inkar
Frequent Visitor

Thanks a lot for your help!

I have a question - How can i add exception email address to "When new email arrives in shared mailbox"? Users cc-ed shared mailbox's address and then my flow is looping and sending hundred emails to itself 🙂

JC80
Frequent Visitor

It would depend. Do you have a single domain you want to avoid or a few specific email addresses?

In my particular use case I implemented 2 steps to avoid the loop you describe.

 

1. Filtered the subject to reject anything that carries "Auto Reply" in the subject line

2. Set an OR statement and typed the domains I wanted to answer only.

 

JC80_0-1607436692949.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,168)