cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
STLAutomator
Regular Visitor

Pulling date / time off email header

Hi!

 

I am trying to create an email auto response to send an email when outside business hours.  I found some great advice here (https://powerusers.microsoft.com/t5/Building-Flows/Schedule-Flow-After-Hours/td-p/244829) but I keep getting stuck when my tests fail.

 

It triggers when a new email arrives to a shared mailbox.

 

I created a "Compose" step that is supposed to return the time of day an email was sent:

formatDateTime(triggerBody()?['DateTimeReceived'],'HH:mm:ss')

 

But when I test, I get this error on that step:

 

Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2779': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

What am i doing wrong?

 

Thank you so much!!!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @STLAutomator ,

 

Please refer to screenshot below to create the flow:

1.png

 

The dayofWeek expression in the Condition:

dayOfWeek(triggerBody()?['receivedDateTime'])

 

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
efialttes
Super User III
Super User III

Hi!

Use

triggerBody()?['receivedDateTime']

instead

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Thank you for your reply efialttes! I tried this and my test seemed to work through compose but got hung up at the condition. Any idea why? Code below.

Thanks again!!

{"or":[{"equals":["@dayOfWeek(triggerBody()?['DateTimeReceived'])",0]},{"equals":["@dayOfWeek(triggerBody()?['DateTimeReceived'])",6]},{"and":[{"equals":["@greaterOrEquals(outputs('Compose'),'08:30:00')","@false"]},{"equals":["@lessOrEquals(outputs('Compose'),'17:30:00')","@false"]}]}]}

Error msg


InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2778': 'The template language function 'dayOfWeek' expects its parameter to be a string that represents a timestamp. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#dayofweek for usage details.'.

Hi again
The reason is the same, see my last comment
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



@efialttes thank you!  Even when I make your suggested change, I get this error below.  Do you know why?

 

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2779': 'The template language function 'dayOfWeek' expects its parameter to be a string that represents a timestamp. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#dayofweek for usage details.'.

 

Thanks!

Hi @STLAutomator ,

 

Please refer to screenshot below to create the flow:

1.png

 

The dayofWeek expression in the Condition:

dayOfWeek(triggerBody()?['receivedDateTime'])

 

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,820)