I have a flow that starts when a planner task is completed. It finds the description and the assigned users and inputs that information in a SharePoint list. The problem is that the flow seems to pull the name(s) of whoever was assigned AND who completed the task.
I'm looking for help with fixing the flow so that it either pulls only who was assigned at the time it was completed OR the user ID of whoever completed the task.
I’ve tried using compose with the expression: triggerBody()?[‘completedBy’]?[‘user’]?[‘id’] to find the user id for who completed the task, but keep getting a failed response.
Any help that can be provided is greatly appreciated!
Solved! Go to Solution.
Hi @Megs_beach ,
You could use the expression to get Completed by user id and get the user profile:
So my current flow will show who was assigned to the task, but it seems to also show anyone who was ever assigned to the task and the user id of who completed the task.
If possible, I need to limit this to ONLY the last person assigned or the person who completed the task, not all users.
I attempted to use the expression you provided but got the same error message (copied below):
”The ‘inputs.parameters’ of workflow operation ‘Get_user_profile_(V2)’ of type ‘OpenApiConnection’ is not valid. Error details: The resolved string values for the following parameters are invalid, they may not be null or empty: ‘id’”
any other ideas?
@Amanthaper, that may work. I am new to power automate and not familiar with the Parse JSON. Would you be able to provide more instruction on how to set up the flow? I tried to follow the picture, but I think I’m missing something.
thanks in advance for your help!
Thank you for sharing this information. I figured out how to adjust the expression to find the user id of the user who completed the task.
My issue now is that it pulls the same user name multiple times when several tasks are completed at the same time. I have all concurrancies set at 1, but that does not seem to help. Any suggestions on how to keep it from pulling the name multiple times?
Can you please post some pics of your flow and planner tasks and what seems to be the issue? Something seems amiss. There should only be one completed user regardless of multiple people assigned to a task and if you're using the expression in an apply to each loop then you should only get back one result. Let's take a look at your flow.
I can’t do pics right now, but the flow runs like this:
1. when a planner task is completed
2. initialize variable for the user id
3. Apply to each:
A. “Get task details” for the task completed
B. “Compose” to get the description from the planner task
C. “Get user profile (V2)” to get the if of you completed the task. This uses an expression of: item(‘Apply_to_each’)?[‘completedBy/user/id’]
D. “Append to sting variable” for the display name
E. “Get items” from a SharePoint list
F. “Apply to each”/“Condition” - does the value in the Planner ID column on the SP list match the planner task id
1. Update the SP list item with the display name of who completed the task and the description
2. Create a new SP item on a new SP list and copy the information from the item that was updated
3. Delete the item from the first SP list.
All of the concurrencies from top to bottom are set to 1. The problem I get is that when I complete multiple tasks at the same the column where it puts the name of who completed the task gets multiple names after the first task (I.e. the first take update gets only 1 name, the 2nd task updated gets 2 names, the 3rd gets 3 names and so on). The flow works great if you’re only completing 1 task at a time, but it’s more likely that several tasks will be completed at the same time.
You need to set your String variable to null at the end of each loop.
Append just means "Add". So the first time through the loop, the value of the variable is null and gets "user1" added to it for a final value of "user1".
The second time through the loop, the value of the variable is "user1" and gets "user2" added to it for a final value of "user1user2".
if you set the string variable to null before it iterates through the loop again, that should solve this problem
please let me know if you have any questions.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.