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 / Filter a gallery based...
Power Apps
Unanswered

Filter a gallery based on user access

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I created a custom login form for my app. On my Login(SP1) I have a column for user access("User", "Lead"). I am trying to figure out how can I filter a Gallery(SP2) by user access.

 

For User: Gallery should be filtered by Projects assigned to him/her.

For Lead: Gallery should be filtered by projects (projects created by Users) assigned to her team.

 

Thanks in advance.

 

Categories:
I have the same question (0)
  • tchin-nin Profile Picture
    779 on at

    Hi @Anonymous So correct me if I'm wrong, you have 2 SharePoint Lists :

    1- Login - collecting the list of users that can access the app with a notion of role : User/Lead. What is the data structure of this list ? 1 column type Person for the user, 1 column type Choice for the role and 1 column type Text for te Team ?

    2- A list of items assigned to a user. 

     

    You want for a regular user to see only items assigned to him. And for a Lead to see all items assigned to a member of his team .

     

    Another important question is how many items that list contains ?

    You might have to work around  delegation issues. 

     

    Théo

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @tchin-nin

     

    For Login SP - Yes there are 2 columns, 1st is for User (type: Person) and the 2nd is for Lead (type: Choice)

     

    Yes you are correct, "Regular user to see only items assigned to him. And for a Lead to see all items assigned to a member of his team"

     

    Probably the list will contain less that 500 items. Hoping you can help me out.

     

    Thanks.

  • tchin-nin Profile Picture
    779 on at

    So in the Login SP, the choices for the Lead column are lead display names ?
     
    You'll have to determine the user role OnStart or OnVisible property of your home screen. Then we'll be able to filter the gallery.
    In my example :
    Login is your role list in SP with User(person) and Lead(choice that contains DisplayName) columns
    DataSource is the list of your items you want to filter with AssignedTo (person) column


    Screen.OnVisible : 
    Set(currentUser,User()); //for better performances, I set a variable containing the current user. I'll use this variable instead of the User() function
    Set(currentUserRole,If(!IsBlank(LookUp(Login,currentUser.FullName exactin Lead.Value,ID)),"Lead",!IsBlank(LookUp(Login,currentUser.Email exactin User.Email,ID)),"User")

     

    Then your Gallery.Items :

    Filter(DataSource,(currentUserRole = "User" && currentUser.Email exactin AssignedTo.Email) || (currentUserRole="Lead" && CurrentUser.FullName exactin LookUp(Login,AssignedTo.Email=User.Email,Lead.Value)))
     

    Give it a shot, I haven't reproduce your exact case so tell me how it goes.

     

    Théo

     

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard