“I’d like to receive an information about a completed Planner task, but Power Automate doesn’t tell me which user completed it!”
If you use the ‘When a task is completed’ Planner trigger, you’ll get a lot of dynamic contents. You get the author, the assigned user, the creation, start, due and completed date, but there’s no information who completed the task. The ‘Completed By’ dynamic content is just not there. Yet it’s still possible to get the information, and this post will show you how.
Extract it from the trigger output JSON
As already explained in the post on parsing JSON, dynamic contents only simplify your work. Power Automate will process the output from an action, and offer you the values it recognises as dynamic contents. If something is missing among the dynamic contents, it doesn’t mean that the information isn’t there. It just wasn’t offered directly.
Take the output from the trigger action, and place it in a text editor (I prefer Visual Studio Code). You’ll see that it contains the ‘completedBy’ property.
The information is there, you just need to extract it. The displayName will be empty, but there’s also the user id to identify the user. Take the user id using an expression.
triggerOutputs()?['body']?['completedBy']?['user']?['id']
Once you have the user id you can use it to search for the additional user information. Add the ‘Get user profile (V2)’ action, use the expression as the input, and take the information you need.
Summary
If you’re looking for something specific and you don’t see it among the dynamic contents, try to check the JSON output. As you can see in this post, even though Power Automate doesn’t offer directly the user who completed the Planner task, you can still extract it from the JSON. It’ll be only the user id as that’s what Planner gives you, but once you have it it’s easy to find the other user information.
Hi Tom, useful article both in terms of getting the ID and how to parse the JSON properly. However, I’ve run into an issue recently were I’ve been trying to set up another Flow with this step in it. There seems to have been a change in the output code from the trigger step, and there is now an array included after the ‘body’ object. This array has the title ‘value’, and in order to select the required objects within this array, I used the code below. The ‘completedBy’, ‘user’ and ‘id’ properties remain the same.
triggerOutputs()?[‘body’]?[‘value’][0]?[‘completedBy’]?[‘user’]?[‘id’]
Following up with what Callum said on an earlier reply, as of today I got this code to work by modifying the expression to:
triggerOutputs()?[‘body/value’]?[0]?[‘completedBy’]?[‘user’]?[‘id’]
I guess there was another change in the output code from the trigger step.
I am not using when task is completed trigger.
Completed By User ID
List Tasks Action: The completedBy field is available for some tasks in the response body.
Challenge: How can I reliably extract the completedBy user ID from the tasks?