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. 😉
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.
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.
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
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional