web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery based o...
Power Apps
Unanswered

Filter Gallery based on user logged in and also show all the records to admin user

(0) ShareShare
ReportReport
Posted on by 12

Hello,

I am new to the power apps, I am able to filter the gallery based on user logged in as per below:

App.OnStart – Set(varUser, User());

App.Items -  Filter(‘TestSharePointList’, Email = varUser.Email);

 

However, how can we show all the records of the gallery to Admin along with above? 

 

Please help! 

Thanks
Anmol

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    App doesn't have an Items property, Do you mean Gallery control Items property?

     

    //pseudo formula, modify as needed
    If
    (
     ,LookUp(SomeUserStatusList, Email = varUser.Email).SomeStatusColumn = "Admin"
     ,'TestSharePointList'
     ,Filter('TestSharePointList', Email = varUser.Email)
    )

     

    Does it help @powerappsrooki ? You may need to modify above as appropriate.

  • Verified answer
    Feiteira Profile Picture
    199 on at

    Hi there @powerappsrooki

     

    First of all welcome to the #PowerAddicts family 😊

     

    If you want to show Records to "Normal users" and "Admins", you will have to set those users somewhere.

    Here are some options:

    • O365 Groups
    • SharePoint List
    • Additionaly, you could use security roles if you were using Dataverse.

     

    As a quick fix I suggest you use a SharePoint List to configure who are the Admins. Nevertheless, if you need a more robust and secure fix, use O365 Groups (the better practice)

     

    Using a SharePoint List you just need to add a collumn of type "Person or Group " (lets call it "User") in that list (lets now called it "PowerAppAdmins") and insert the users you want to.

     

    On the PowerApp side, you can then use this:

    On the OnStart

    If(
     IsBlank(LookUp('PowerAppAdmins', ThisRecord.User.Email = varUser)),
     Set(
     Admin,
     false
     ),
     Set(
     Admin,
     false
     )
    )

    On the Items

    If(
     Admin,
     TestSharePointList,
     Filter(‘TestSharePointList’, Email = varUser.Email);
    )

     

    This way you have two account types, the Admin one, who needs to be listed in the SharePoint List called "PowerAppAdmins" and the default user type, who can only see his records.

     

     

    Let me know if this worked out for you 😀

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @Feiteira Thanks for the detailed response! 🙂

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @Feiteira After I checked your response, I also modified my formula to be more correct,  I noticed it was not initially until now.

    However, the modifications @powerappsrooki has to make to my pseudo-formula I gave, might need to be the ones you described in more detail, so thank you for providing the additional details @Feiteira .

  • Feiteira Profile Picture
    199 on at

    Thank you @poweractivate , much apreciated coming from you 😀

    Now lets see if our buddy @powerappsrooki can get it to work like that 😋

  • powerappsrooki Profile Picture
    12 on at

    Thank you so much, Yes, this is how I wanted. @Feiteira

  • Inini Profile Picture
    2 on at

    @powerappsrooki Struggling with the complete syntax. Can you please post your final syntax.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard