I'm trying to build a canvas app to get all the security roles a User has associated to them.
The User -> Security Role part is working fine.
However when I'm trying to get the Team -> Security Role relationship into my app I get the following error.
The specified column is not accessible in this context.
I'm using the Following Statement First(Teams).'Security Roles'
Is there another way to get the information from this relationship into my canvas app?
Wow! Great work @davidjfafonso !! Works like a charm at first try. I'll look into what you wrote a bit later but we can definitely work with this.
@crazyguy @Anonymous
This is not the prettiest solution but it will work:
Set(currentUser, LookUp(Users, 'Primary Email' = User().Email));
// User Roles
ClearCollect(UserRoles, currentUser.'Security Roles (systemuserroles_association)');
// User Teams
ClearCollect(UserTeams, currentUser.'Teams (teammembership_association)');
ClearCollect(UserTeamsAux, UserTeams);
// All Roles (User + Teams)
ClearCollect(AllUserRoles, UserRoles);
ForAll(
UserTeams,
Collect(AllUserRoles, LookUp(UserTeams, 'Team Name' = First(UserTeamsAux).'Team Name').'Security Roles');
Remove(UserTeamsAux, First(UserTeamsAux));
)
The "AllUserRoles" collection will contain all the roles (user roles + teams roles).
Same issue here, just figured out that I need to do this. Will post the solution if I found a way. Doesn't seem straightforward though.
KR,
Felix
Hi @crazyguy ,
have you have solved this problem? Have exactly the same problem.
Just want to find out all security roles of a specific user and all connected teams security roles..
To work with a gallery wouldn't be a way for me as well. Just want to check all security roles at the App start.
BR,
Sven
Thank you for your answer but this isn't what I want to do.
I want to have a collection with all the security roles from the user.
So at the start of the app. I'm getting the current user from CDS.
Hi @crazyguy ,
Could you please share a bit more about your issue?
Do you want to list all available Security Roles for a specific team?
I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:
Add two Galleries in your app, set the Items property of the first Gallery to following:
Teams
set the Items property of the second Gallery to following:
Gallery1.Selected.'Security Roles'
Please make sure you have configured proper Security Roles for the specific team in your Org. Please consider go to your Power Platform Admin Center, then click Environments tab, find your current Environment, then click "Settings" option, then expand the "Users + permissions" option, then click "Teams" option:
then within the opening Teams record page, switch View option to "All Owner Teams", then select specific team, then click "Manage Roles" option in Top Menus:
then check if you have assigned Security Roles for the selected team.
Best regards,
ankit_singhal
11
Super User 2025 Season 1
mmbr1606
9
Super User 2025 Season 1
stampcoin
9