Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Add the manager to the subordinate collection

(0) ShareShare
ReportReport
Posted on by 714 Super User 2025 Season 1

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:
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Add the manager to the subordinate collection

    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.

  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Add the manager to the subordinate collection

    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.

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: Add the manager to the subordinate collection

    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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard