@JoshL could you please help me regarding your error checking on "assigned to user id". I have the following flow, but if a task is not assigned then i get an error because i use the variable containing "Display Name" in my "Update Sharepoint item" and when the task is not assigned i get "status 400" something with "user not found".
If the "assigned to" id is found, the flow works perfectly.
Any pointers is highly appreciated!
Use the following logic:
Check to make sure that the assignee data you're accessing isn't null. If it's null, set your variable to Unassigned. Then when grabbing the display name for the assigned to user, you can use a parallel branch to run on a fail. That means, if it fails trying to get the display name then it's probably unassigned.
I hope that helps!
Thank you so much for your time, though im still struggeling with your logic as the "Get Assignee" condition, i cannot set the variable to "Unassigned" because then my "Update Sharepoint item" returns error (Status 200, something with user not being found), i think it has something to do with the column in the sharepoint list is formatted as username/claims).
Now i only need to figure out how to concat multiple names and delimit them with ";" so all assigned to Display Names gets transfered to Sharepoint.
Though i got the wanted outcome by doing the following below, it takes your "check if null" example and branches out to two different "Update Sharepoint item", one with my "DisplayName" variable and the other without.
(or anyone else)
Can you help me troubleshoot what I'm doing wrong here? My goal is to export all tasks with user display name and bucket name to Excel. The error is relating to the scope of the 'Apply to Each' loop but I can't move the AID variable inside the loop.
My aid value is:
substring(string(items('Apply_to_each')?['assignments']), 2, 36)
You can't initialise a variable in a loop because initialisation can only happen once. It's the initial data being assigned to that variable. Flow uses this as a variable declaration and initialisation so this is why you can't put it in a loop. It's also good practice to declare and initialise variables first then give them data. As to why the substring code isn't working outside the loop...
Let's break this down:
Substring is modifying its contents to only return the specific string. In this case it's between characters 2 and 36. So far so good, so what's inside substring?
String is turning its contents into a string type. Ok, so what is the string function turning into a string?
Now this is broken down like so:
This is referring to the items being looped over in the apply_to_each loop and
is referring to the specific 'assignments' data in the item object (since they're JSON).
This doesn't make any sense to your variable initialisation because A: What 'Apply_to_each' loop? and B: What items? You cannot refer to data that hasn't been pulled in or created yet.
First we initialise our variables to empty at the start so they're clean and ready to use.
Now, we'll pull in the data we'd like to use. For planner we'll pull in the tasks.
Now the data has been pulled in, we can access it inside our loop (if your flow only process one task, you do not need a loop).
I this helps,