power-automatemicrosoft-planner

Power Automate Get Planner Task Assignee Names


I'm working on a Power Automate flow where the flow is supposed to connect to Planner, get the tasks which are due tomorrow and send a message to an MS Teams Channel.

I got the entire flow working except of one thing - getting the names of the person(s) whom the task is assigned.

Here's my current flow:

  1. Getting the list of Tasks from Planner,
  2. Filter those which have a Due Date set,
  3. Filter the ones which have the Due Date tomorrow,
  4. Get the Name of the Task Creator using Get User Profile,
  5. Send the data into an MS Teams Channel.

enter image description here

This all works perfectly fine. However I also need to get the names of the Assigned users. I understand that they come as an array. And when I try to add it to the same Get User Profile it's getting wrapped into an unnecessary "Apply to Each" which breaks everything.

Does anyone have a clue how this can be solved? Basically I need only 1 Assignee as we are not going to assign the same task to more than 1 person.

Any help would be much appreciated!


Solution

  • In order to avoid the loop (which is also a valid approach, long story) then you can use an expression to get the first (in case there are multiple) assigned user.

    This is an example where you don't need to loop ...

    Flow

    ... you can see I've initialised a (string) variable at the top which will hold the user ID GUID.

    Assigned To

    ... then further down in the Set Assigned To operation, this is the expression I use ...

    item()?['_assignments'][0]['userid']
    

    That gets the first user and then the associated userid property. You can then pass that into the Get user profile (V2) task ...

    Get User Profile

    Obviously, you need to adapt that to your flow but I hope that makes sense.