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.