cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Dual Super User II
Dual Super User II

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

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User II
Dual Super User II

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

View solution in original post

Highlighted
Super User II
Super User II

@surfer1978 

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

 

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.

Highlighted
Community Support
Community Support

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.

Highlighted

Thank you @RezaDorrani  that worked perfectly 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,249)