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

How to filter returned Project Online tasks from "Lists Tasks" action?

So I basically have a flow that updates fields in a tasks. My issue now is the performance since I have to loop through every task, check if it's work order matches the one in my csv file, and then update that task's fields.

 

I have an action that returns all the tasks for a project.

 

List_tasks.png

 

I'm looking for another way to do this so I don't have to loop through every task, which is what I initially tried. Only issue was how it would take forever for the flow to finish running.

 

Apply_To_Each_Task.png

 

Every task has data and I can pull the correct custom field by doing:  "items('Apply_to_each_Task_')?[variables('GetWorkOrderId')]" within the "Apply to each Task" action. I use that in the "Set variable" action here.

 

I've tried using a "Filter array" action but it doesn't work. 

 

filterattempt.png

It just returns an empty array. Is this possible to do? Am I missing something in the filter array? Thank you.

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: How to filter returned Project Online tasks from "Lists Tasks" action?

@Mgodby 

A much better way of approaching this might be to use a Filter query - see my screen shot below.  If you construct the query properly, you won't need to loop through all tasks - only tasks that meet your requirements will be returned.  You condition can also be eliminated. Here is a link to a blog post that discusses how to construct the OData filter query.

The blog post discusses SharePoint but Project Online rubs on SharePoint so the same rules apply.

Listtasks.png

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

Scott
Highlighted
Helper V
Helper V

Re: How to filter returned Project Online tasks from "Lists Tasks" action?

Thank you for the help. But it doesn't seem to work for me. I tried using the Id for the filter and it still returns nothing even though I'm using an Id that I know exists.

 

This is what is returned when I get all tasks with no filter.

 

ListTasksAll.png

 

But then when I try to do a filter using the Id and asking for the value that you see above, I get nothing.

 

FilterTaskPlease.png

 

Is there something wrong with my filter syntax? 

Highlighted
New Member

Re: How to filter returned Project Online tasks from "Lists Tasks" action?

This is a little bit of a kludge, I faced the same problem as you where the "list Tasks" flow with a filter returned empty.

 

For small projects this would be OK - i could see this being a problem with a larger project.  Basically I used a for loop and checked each task that is returned for the task ID I wanted to manipulate. 

 

TaskFilter.png

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.

Upcoming Events

Experience what’s next for Power Automate

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

Users online (7,889)