cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
knandez05
Helper III
Helper III

Date format in Approval email

Hello,

 

I created a flow with a set of multi level approvers. The date/time stamp is added to the following approvers email but the formatting is off after my first approver. How can I get the date/time format to look as the first one?

 

Thank you in advance!

 

Approval date format.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
tingtingluo
Microsoft
Microsoft

Hi @knandez05 

 

This is connector limitation - it's impossible to change date format in email generated by the approval connector itself.

 https://docs.microsoft.com/en-us/connectors/approvals/

tingtingluo_0-1614650164461.png

If you would like this Date in other format in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

For now, a work around is to use send an email (V2) connector with a new forwat date from Composer.

Otherwise, Teams approval app shows a better date format.

 
 

Thanks

View solution in original post

8 REPLIES 8
tingtingluo
Microsoft
Microsoft

Hello,

Please try to use expression "formatDateTime" to format the datetime.

 

For more details:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

In this scenario, you may try to create a flow and configure the code to format the datetime using the following function:

formatDateTime(body('Start_an_approval')?['responseDate'],'MMMM dd,yyyy hh:mm tt')

tingtingluo_0-1613829708584.png

 

tingtingluo_0-1613829668661.png

 

If I have answered your question, please mark your post as Solved.

 

Thank you.

Thanks for your response @tingtingluo. This is all very new to me and I need a little bit more direction. 

 

The function/expression you provided, would I create a Compose action with this expression or do I use this in place of where the date should be in the approval email?

 

I have several approval emails throughout my workflow. 

approval date format.jpg

tingtingluo
Microsoft
Microsoft

Hi @knandez05 

Thanks for the instant reply.

The Compose action is like a static variable. It can be placed anywhere within your flow, and its value can be accessed from anywhere within the flow. The value is persistent – once it is set it cannot be changed.

It's convenient to convert the format of several Date fields. To make the Compose card easier to find later, rename it by selecting the text Compose on the title bar of the card and entering a name that's easy to remember.

https://docs.microsoft.com/en-us/power-automate/data-operations#use-the-compose-action

https://www.powerautomatetraining.co.uk/post/the-compose-action

Best Regards,

Thank you  When I try to add to my flow, I get the following errors when saving.

 

The template validation failed: 'The action(s) 'Start_an_approval' referenced by 'inputs' in action 'Compose_4' are not defined in the template.'

 

Correct to include a valid reference to 'Start_an_approval' for the input parameter(s) of action 'Compose_4'.

 

compose flow error.jpg

tingtingluo
Microsoft
Microsoft

Hi  @knandez05 

I suddenly realized that there are some differences between Create an Approval vs. Start and Wait for an Approval acion. For the second one, when I try to select the Dynamic content for an expression, the list of available options has already reduced down to only:

Approval ID

Body

Completion Date

Details

Item Link

Item Link Description

Outcome

Request Date

Response Summary

Title

 

Inspired by the article here: https://tomriha.com/avoid-apply-to-each-after-single-approval-response-in-power-automate/

1. Using the ‘Apply to each’ action to process each of the Responses object in the approval out array.

1s.png

2. Add the 1st compose action, select 'Responses Response date' from Dynamic content  list. And rename the action to 'Respons Date Time'.

2s.png

3. Add the 2nd compose action. 

Expression :

formatDateTime(outputs('Response_Date_Time'),'MMMM dd,yyyy hh:mm tt')

The first parameter outputs('Response_Date_Time') should be the Output of the prior Compose action, which was renamed to"Response Date Time"

3S.png

 

Result:

output.png

I hope this resolves the issue for you.

Thank you.

@tingtingluo Thanks for the additional input. I followed the steps you provided but it seems that it is still not working. 

 

workflow format date setup.jpg

formatDateTime(outputs('Response_Date_Time'),'MMMM dd,yyyy hh:mm tt')

 format date test.jpg

tingtingluo
Microsoft
Microsoft

Hi @knandez05 

 

This is connector limitation - it's impossible to change date format in email generated by the approval connector itself.

 https://docs.microsoft.com/en-us/connectors/approvals/

tingtingluo_0-1614650164461.png

If you would like this Date in other format in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

For now, a work around is to use send an email (V2) connector with a new forwat date from Composer.

Otherwise, Teams approval app shows a better date format.

 
 

Thanks

View solution in original post

knandez05
Helper III
Helper III

Thank you again @tingtingluo. This information and help is much appreciated. 

Helpful resources

Announcements
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

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (18,689)