Skip to main content

Notifications

Community site session details

Community site session details

Session Id : LBmyHRFzpFU4xxMQnE6B1Q
Power Apps - Microsoft Dataverse
Answered

Team related Security Roles in Canvas App

Like (1) ShareShare
ReportReport
Posted on 18 Feb 2020 15:01:12 by 17

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?

Categories:
  • Community Power Platform Member Profile Picture
    on 28 Dec 2022 at 15:03:33
    Re: Team related Security Roles in 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.

  • Verified answer
    davidjfafonso Profile Picture
    8 on 28 Dec 2022 at 11:55:31
    Re: Team related Security Roles in Canvas App

    @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).

  • Community Power Platform Member Profile Picture
    on 22 Feb 2022 at 15:48:19
    Re: Team related Security Roles in Canvas App

    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

  • KSven Profile Picture
    182 on 29 Jul 2021 at 07:49:35
    Re: Team related Security Roles in Canvas App

    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

  • crazyguy Profile Picture
    17 on 20 Feb 2020 at 09:55:23
    Re: Team related Security Roles in Canvas App

    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.

     

    Set( currentUser,LookUp(Users, 'Primary Email' = User().Email ));
     
    With that i'm collecting all of the users directly associated security roles via:
    Collect(securityRoles, currentUser.'Security Roles'); 
    This is no problem and working as expected.
     
    Then i'm collecting all teams a user is part of and the teams associated security roles via:
     
    With({teamids : currentUser.'Teams (teammembership_association)'.Team},With({teams:Filter(Teams, Team in teamids)},ForAll(teams, Collect(securityRoles, 'Security Roles')))
     
    And in the last part of this function it gives an error stating "The specified column is not accessible in current context".
     
    if I Select one Team using First(Teams).'Security Roles' is doesn't give that error indeed.
     
  • v-xida-msft Profile Picture
    on 19 Feb 2020 at 04:09:59
    Re: Team related Security Roles in Canvas App

    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:

    2.JPG

     

    3.JPG

    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:

    4.JPG

     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:

    5.JPG

    then check if you have assigned Security Roles for the selected team.

     

    Best regards,

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#2
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 9

Overall leaderboard

Featured topics