web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting all tasks in a...
Power Automate
Answered

Getting all tasks in a Group

(0) ShareShare
ReportReport
Posted on by 43

Hi there,

I am looking for a way to get all the taks in a group. The problem we face is that we have variable Plan ID's because so i cannot us the ID of a standard plan in the group. That's why i need the tasks on group level.


Other option could be the get all tasks with a certain word in it. 

 

Hope someone can help.


Robert

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Firefly1,

     

    You can combine a couple of Graph API requests. I would suggest to use the List plans in a group and the list plan tasks methods. 

     

    I tried combining them into one with an expand, but Graph API does not seem to support that. Also filtering on tasks seems to be not supported. That's why I am using a Filter array action instead.

     

    Below is an example

     

    1. First Send an HTTP request action (groups connector) uses the uri below to retrieve all plan ids of a group:

    https://graph.microsoft.com/v1.0/groups/@{variables('GroupId')}/planner/plans?$select=id

     

    2. Apply to each uses result from the value property

    outputs('Send_an_HTTP_request')?['body']['value']

     

    3. Second HTTP request action retrieves the tasks per plan id

    https://graph.microsoft.com/v1.0/groups/@{variables('GroupId')}/planner/plans/@{item()['id']}/tasks

     

    4. Filter Array filters for tasks with a title which contains a certain word (Stored in a string variable called CertainWord)

     

    From

    outputs('Send_an_HTTP_request_-_Tasks')?['body']['value']

     

    Filter Criteria

    @contains(item()['Title'], variables('CertainWord'))

    coupleofplannerrequests.png

  • Firefly1 Profile Picture
    43 on at

    @Expiscornovus thanks for the input so far step 1 until 3 works, when i try to save step 4 i get the following error:

    Flow save failed with code 'InvalidVariableOperation' and message 'The inputs of workflow run action 'Filter_array' of type 'Query' are not valid. The variable 'opgeleverd' must be initialized before it can be used inside action 'Filter_array'.'.

    This is the filter criteria i added:
    @contains(item()['Title'], variables('opgeleverd'))

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Firefly1

     

    I have added an Initialize variable action at the beginning of my flow. Forgot to add that to the screenshot, my bad 😅.

     

    Please add that action as well, with in your case the name opgeleverd.

  • Firefly1 Profile Picture
    43 on at

    Hi @Expiscornovus ,

    That worked, as initialize variable type is used string.

    When i tested the step, the last step failed:

    Firefly1_0-1688389136474.png

    Any idea why?

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Firefly1,

     

    I used the value property nested within the body of the Send an HTTP request 2 action response. Can you make sure you also used the value property?

     

    Try to add it as an expression in the From field of the filter array:

     

    outputs('Send_an_HTTP_request_2')?['body']['value']

     

  • Firefly1 Profile Picture
    43 on at

    When i use this value in Apply to each:
    outputs('Send_an_HTTP_request')?['body']['value']

    I cannot save it, flow checker gives the following notification:
    outputs('Send_an_HTTP_request')?['body']['value']

    Is it possible for you to export your flow so i can import it and try?


  • Firefly1 Profile Picture
    43 on at

    @Expiscornovus the problem seems to be cause by the ['value'] of the outputs('Send_an_HTTP_request')?['body']['value']

    Or do i have to insert a specific value to replace ['value'] with?

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Firefly1,


    Can you please use the code snippet I shared earlier? The name of the action needs to exactly match whatever name you are using in that outputs function.

     

    Since your action name in your screenshot of the HTTP request action within the apply to each loop is 'Send an HTTP request 2' the expression should be:

     

    outputs('Send_an_HTTP_request_2')?['body']['value']

     

     

    Your expression refers to the first HTTP action which only retrieves the plans and is outside the loop. 

     

  • Firefly1 Profile Picture
    43 on at

    @Expiscornovus my apologies for the confussion, your solution worked!

    Thanks.

    The next challange we face is the following:
    - We now have access to all the tasks in the group. The task "Project opgeleverd" can be found in several projects inside this group.
    - When the task "Project Opgeleverd" is marked completed, we want to create a new task in this specific plan/project in which the task "Project Opgeleverd" is assigned to.

    Do you know how to establish this?

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Firefly1,

     

    In the Filter array you can add a second condition to check if the percentComplete field is equal to 100 (aka completed).

     

    Use the below expression instead:

     

    @and(contains(item()['Title'], variables('opgeleverd')), equals(item()['percentComplete'], 100))

     

     

    After that action you can add another apply to each, which can loop through the body of the Filter array. If that Filter Array does not return any completed tasks, it will simply skip it.

     

    Within that apply to each you can add a Create a new task action. Make sure you use the items function to refer to the plan id:

     

    items('Apply_to_each')['id']

     

     

    Below is an example

     

    overdrachtnaarbeheer.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard