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

Using Filter Array with Planner Dates and UTC(now)

Hello,

I have a flow that will periodically that is supposed to filter for Planner tasks that have due dates more than 30 days from today.  

augustine2_1-1634049166732.png

 

We are initializing today's date as string as 'TestDate'.  The value for TestDate is

formatDateTime(addDays(utcNow(),-30),'yyyy-MM-ddThh:mm:ssZ').
 
We use a filter array where due date is less than TestDate which should bring tasks that have due dates more than 30 days from today.  However, we are getting the error "The execution of template action 'Filter_array_3' failed: The evaluation of 'query' action 'where' expression '@less(items('Apply_to_each_2')?['dueDateTime'], variables('TestDate'))' failed: 'The template language function 'less' expects two parameter of matching types. The function was invoked with values of type 'Null' and 'String' that do not match.'.

 

We want to ultimately use the "Delete a Task" Planner action to bulk delete these tasks.  But we can't get past this stage.

Any help will be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Community Champion
Community Champion

@tom_rihasuggestion is for the flow to look something like this:

ekarim2020_1-1634063851158.png

 

Ellis

View solution in original post

7 REPLIES 7
ekarim2020
Community Champion
Community Champion

This error is due to the fact that some of your tasks do not have due dates. It fails because it is trying to compare a null value with a date-time variables('TestDate').

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

tom_riha
Super User
Super User

Hello @augustine2 ,

move the 'Filter array' out of the 'Apply to each', you don't need to process the tasks one by one, Filter array will take the whole array and filter it.

The 'Apply to each' and the error was caused because you entered the 'value Due Date' first in the 'Filter array', you should enter the From 'value' first and only then the 'value Due Date', that way it won't add the loop.

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

thank you much.  I filtered out the nulls and still had the same error.

Let me try this and will let you know.

I can't really take move the filter array out of the "Apply to Each" because of the List Tasks action. 

 So, I tried this:

augustine2_1-1634063264700.png

 

But, I'm getting this error: 

The 'from' property value in the 'query' action inputs is of type 'Object'. The value must be an array.

ekarim2020
Community Champion
Community Champion

@tom_rihasuggestion is for the flow to look something like this:

ekarim2020_1-1634063851158.png

 

Ellis

View solution in original post

Got it! Thank you

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,908)