web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add the manager to the...
Power Apps
Answered

Add the manager to the subordinate collection

(0) ShareShare
ReportReport
Posted on by 716 Moderator

So I have populated a collection using:

ClearCollect(
 colTechTeam,
 Office365Users.DirectReportsV2("someone@somewhere.com")
);

The current user's email is stored using this:

Set(
 varCurrentUserEmail,
 User().Email
);

Then I make a filtered collection if the current user is in the list:

ClearCollect(
 colFilteredTechTeam,
 Filter(
 Ungroup(
 colTechTeam,
 value
 ),
 mail = varCurrentUserEmail
 )
);

Visible properties use this:

If(varCurrentUserEmail in colFilteredTechTeam.mail,true)

 

This all works a treat as they say. But, I need to include the manager whose email we used to populate the first collection and I can't figure out how since that collection is inside of a value. And if I try to add them directly to that collection, it actually adds 'columns' to the value table above where the real collection is.

 

It seems like it's probably easier to forego adding them to that first collection since what we really use for visibility is the filtered collection.

 

So my question becomes, how can I modify the second ClearCollect that populates colFilteredTechTeam so that it adds the user if mail = varCurrentUserEmail or "someone@somewhere.com".

 

And I think I just realized how I need to go about it, I just need to get the syntax right.

Which I'd still appreciate help with. 😉

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @DCHammer ,

     

    Please try this

    ClearCollect(
     colTechTeam,
     Office365Users.DirectReportsV2("someone@somewhere.com").value,
     Office365Users.UserProfileV2("someone@somewhere.com")
    );
    Set(
     varCurrentUserEmail,
     User().Email
    );
    ClearCollect(
     colFilteredTechTeam,
     Filter(
     
     colTechTeam,
     
     mail = varCurrentUserEmail
     )
    );

     

    Best Regards,

    Wearsky

  • DCHammer Profile Picture
    716 Moderator on at

    Well the code throws no errors. I'll update as soon as the manager tests. And thanks for the lesson. This is reusable knowledge. I have future requirements that will need this type of logic for teams/groups.

  • DCHammer Profile Picture
    716 Moderator on at

    I forgot to come back to update. Worked perfectly. Thank you so much for this. It's something I'll end up using a lot.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard