cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
surfer1978
Level: Powered On

Format all planner task dates in Flow

Hi

I am trying to format dates for planner tasks when I email them.

 

I followed this solution

https://powerusers.microsoft.com/t5/Building-Flows/Planner-Flow-Date-Value-Format-Error/m-p/249542#M...

 

I have found that if there is no date in the planner task due date, the flow will fail to run, is there any way to skip trying to format the date if the duedate is null?

 

I also need to do this to the start date and the completed date, is there an elegant way to basically get all the dates from the task details and if there are any dates present format them so I can use them in an email template?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Level 10

Re: Format all planner task dates in Flow

Hi @surfer1978 

 

In that second compose 2 action

use the following expression

 

if(equals(outputs('Compose'),null),'',formatDateTime(outputs('Compose'),'yyyy-MM-dd'))
This will only format the date if it exists else output blank
 
You can do the same for the other date fields
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

4 REPLIES 4
RezaDorrani
Level 10

Re: Format all planner task dates in Flow

Hi @surfer1978 

 

In that second compose 2 action

use the following expression

 

if(equals(outputs('Compose'),null),'',formatDateTime(outputs('Compose'),'yyyy-MM-dd'))
This will only format the date if it exists else output blank
 
You can do the same for the other date fields
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Super User
Super User

Re: Format all planner task dates in Flow

@surfer1978 

Reza and I responded at the same time....his is better. go with that Smiley Wink   

 

Hi there!

So...dates are all going to be stored the same way.  I'm guessing you'll want to change the presentation before they are presented in an email, right?

There are a few ways to go about this depending on how comfortable you are with expressions.  It's not my strongest point, but I've found this kind of thing to be handy...

 

Here's the one from the thread you mentioned:     formatDateTime(outputs('Compose'),'yyyy-MM-dd')


So, we want to see if the field is empty before trying to format it, right?   Try this in the expression box:   if(empty(outputs('Compose'),'',formatDateTime(outputs('Compose'),'yyyy-MM-dd')))

 

Totally winging it so it may yell at you, but basically asking if there's a value in the output, and if not keep it blank, and if so, format the value.

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Community Support Team
Community Support Team

Re: Format all planner task dates in Flow

Hi @surfer1978 ,

 

Have your problem been solved?

Please take a try with @edgonzales's  and @RezaDorrani 's  solution, and you could also consider adding a Condition under the Compose 2 action to check if the task due date is null, and you could add different Set TaskDetails Variable for the task due date in the If yes and If no branch of the Condition.

 

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.

surfer1978
Level: Powered On

Re: Format all planner task dates in Flow

Thank you @RezaDorrani  that worked perfectly 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 53 members 4,918 guests
Please welcome our newest community members: