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

Send email from shared inbox during after-hours time period.

So I've run through about 10 different iterations of condition code to test for whether or not the time an email was received based on metadata (or even the current time when an email was received) and I cannot get the condition to work properly for the life of me. I was able to build a flow on my account using the code below and the condition functioned - however, when I moved the flow over to the shared mailbox, the flow terminates with my status of "canceled" and an indication that the condition failed. Below are my requirements for this condition, everything else is set up correctly as far as I know, but I can share whatever is requested.

 

  • Trigger: email arrives in shared mailbox
  • Condition: check for time the email arrives, make sure it is between 6:30 AM and 5:30 PM local time
    • If yes, terminate the flow (do nothing)
    • If no, check if the message is a reply (currently using "RE: " in subject)
      • If it's a reply, do not send a message (do nothing)
      • If it's a unique message, send an after-hours message from the shared mailbox

I don't get failure, just information that every single message fails the condition and the flow terminates.

 

@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')
	)
)

I'm also including a screenshot of the general setup I have below in case that's helpful.

 

2017-10-11_11-56-07.png

 

Any help getting this to function is appreciated. I've looked through these forums as well as tried a bit of Google-fu and that's how I cobbled my code together, but it just doesn't seem to work. Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Memorable Member
Memorable Member

Hi @Anonymous.

 

Thanks for posting, you was very clareful.

 

Understanding your cenario, if the email wasn't received between 6:30 AM and 5:30 PM you will send an after-hours email.

 

For this your condiction need to use 'or' instead 'and', because:

 - If the received time is less 6:30am = Send Email

OR

 - If the received time is greater 17:30pm = Send Email.

 

You just need to change the first word in your condiction and 'Thaaadá'.

 

Hope this helps!


Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

3 REPLIES 3
Memorable Member
Memorable Member

Hi @Anonymous.

 

Thanks for posting, you was very clareful.

 

Understanding your cenario, if the email wasn't received between 6:30 AM and 5:30 PM you will send an after-hours email.

 

For this your condiction need to use 'or' instead 'and', because:

 - If the received time is less 6:30am = Send Email

OR

 - If the received time is greater 17:30pm = Send Email.

 

You just need to change the first word in your condiction and 'Thaaadá'.

 

Hope this helps!


Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

Anonymous
Not applicable

Hi @gamoraes,

 

 

Thanks for your reply. I've made the change and will do some testing to verify!

 

Best,

 

Brandon

Anonymous
Not applicable

Hi @gamoraes,

 

Thanks for your assistance, who knew something so simple would trip me up? Your change worked through various tests, so I've accepted it as the solution!

 

Best,

 

Brandon

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (95,466)