Hello,
I have a scenario where I want a person that goes into the app to be able to see all those in their org structure (direct reports and indirect reports).
Example Org Structure: Director to individual contributor
John Director-->Jane Senior-Manager-->Tony Manager-->Karen Supervisor-->Emily Employee.
My goal is that when John Director logs in, I would like for him to see Jane, Tony, Karen, and Emily. When I tried to code this, the result I get after John logs in is Tony, Karen and Emily but no Jane (Jane is John's direct report). I wrote the code below to help accomplish my goal but cannot figure out why the direct report is not showing up but the rest of the org structure does:
Clear(colTeam);
Clear(colTeam2);
Clear(colTeam3);
Clear(colTeam4);
ClearCollect(colTeam,Office365Users.DirectReports(User().Email));
ForAll(colTeam,Collect(colTeam2,Office365Users.DirectReports(Mail)));
ForAll(colTeam2,Collect(colTeam3,Office365Users.DirectReports(Mail)));
ForAll(colTeam3,Collect(colTeam4,Office365Users.DirectReports(Mail)));
ClearCollect(colTeam,colTeam2,colTeam3,colTeam4)
Any advice is greatly appreciated. Thank you so much for your help.
Solved! Go to Solution.
last line of code:
Collect(colTeam,colTeam2,colTeam3,colTeam4)
you can try to replace Mail with UPN:
Clear(colTeam);
Clear(colTeam2);
Clear(colTeam3);
Clear(colTeam4);
ClearCollect(colTeam,Office365Users.DirectReports(User().Email));
ForAll(colTeam,Collect(colTeam2,Office365Users.DirectReports(UserPrincipalName)));
ForAll(colTeam2,Collect(colTeam3,Office365Users.DirectReports(UserPrincipalName)));
ForAll(colTeam3,Collect(colTeam4,Office365Users.DirectReports(UserPrincipalName)));
Collect(colTeam,colTeam2,colTeam3,colTeam4)
Hi Alex_10,
Thank you so much for your help. I tried your suggestion and it worked. Thank you so much.
I do have another issue though and that is, although the app is giving me what I was looking for, it does show an error message (see attached). I can click on the x and the app continues to load fine however not sure why the error appears and how to get rid of it. Any ideas?
Again, thank you so much for your help.
you can try to replace Mail with UPN:
Clear(colTeam);
Clear(colTeam2);
Clear(colTeam3);
Clear(colTeam4);
ClearCollect(colTeam,Office365Users.DirectReports(User().Email));
ForAll(colTeam,Collect(colTeam2,Office365Users.DirectReports(UserPrincipalName)));
ForAll(colTeam2,Collect(colTeam3,Office365Users.DirectReports(UserPrincipalName)));
ForAll(colTeam3,Collect(colTeam4,Office365Users.DirectReports(UserPrincipalName)));
Collect(colTeam,colTeam2,colTeam3,colTeam4)
Hi Alex_10,
That worked !! Thank you so much for your insight. Greatly appreciated.