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

compare Planner card createdDateTime to utcNow time...

I'm trying to compare Planner Tasks created time to my current time -60 minutes to see if the Planner Task was created within 60 minutes of the Flow run time. I have a condition set inside an Apply to Each where I get the task and the value Created Date Time 'items('Apply_to_Each')?['CreatedDateTime']' and check if it is less than the 'formatDateTime(addMinutes(utcNow(), -60)', 'MM/dd/yyyy'). If the condition is met, then an email will be sent with the task that meets the condition. Right now it's running successfully, but no email is being sent. What am I doing wrong here?

 

Thanks.

 

flowdatetime.JPGflowresult.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: compare Planner card createdDateTime to utcNow time...

@angelrodriguez it's probably that the dates that are being compared are not in the same format. Add a couple of Compose controls, one for the created date and one for the formatDateTime date. Then run the flow and check that the output of each compose is in exactly the same format.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: compare Planner card createdDateTime to utcNow time...

@angelrodriguez it's probably that the dates that are being compared are not in the same format. Add a couple of Compose controls, one for the created date and one for the formatDateTime date. Then run the flow and check that the output of each compose is in exactly the same format.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

View solution in original post

Highlighted
Helper II
Helper II

Re: compare Planner card createdDateTime to utcNow time...

I was able to fix this based on your advice, but I'm not sure why I'm getting the same output time in my condition.

 

condition2.JPG

the first formula above formatDateTime is written as: 

formatDateTime(items('Apply_to_each')?['createdDateTime'], 'yyyy-MM-ddThh:mm:ss')

 

to grab the time the planner task was created.

 

The addMinutes task is written as:

addMinutes(formatDateTime(utcNow(), 'yyyy-MM-ddThh:mm:ss'), -60, 'yyyy-MM-ddThh:mm:ss')
 
Here you grab the current time and subtract 60 minutes to compare if the formatDateTime falls within 60 minutes of the current time.
 
Here's the output I get:
formatDateTime - Item created on: 2020-01-07T09:00:49
addMinutes - format test date: 2020-01-07T09:00:49
 
When I run the task, it's odd because the times are identical. I'm not sure what I'm missing here. The Flow isn't failing, it's just giving me the same output when the for

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.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,225)