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 Gallery Items b...
Power Apps
Answered

Filter Gallery Items based on two lookup sharepoint list columns

(0) ShareShare
ReportReport
Posted on by 95

Hi All,

I am developing a logistics apps with the following variables set OnStart. These variables are used to determine if the user has certain visibility for case management (i.e. Approve/Reject).

//Set user based security
Set(varUser,User());
Set(isUserAdminSPList,!IsBlank(LookUp('User Roles',User.Email=varUser.Email&&Role.Value="Administrator")));
Set(isUserCMSPList,!IsBlank(LookUp('User Roles',User.Email=varUser.Email&&Role.Value="Construction Manager")));
Set(isUserPMSPList,!IsBlank(LookUp('User Roles',User.Email=varUser.Email&&Role.Value="Project Manager")));
Set(isUserBUHSPList,!IsBlank(LookUp('User Roles',User.Email=varUser.Email&&Role.Value="BUH")))

*'User Roles' is the name of my sharepoint list.

Attached a screenshot of a filtered gallery showing only items made by current user through condition:

varUser.Email = User.Email

Alois_0-1637905758372.png


How do I allow for other users such as:
1. isUserAdminSPList to be able to view all items in the gallery 
2. isUserCMSPList to be able to view all items in the gallery for the identified 5 sites they belong to

Attached the screenshot of 'User Roles'

Alois_1-1637906299297.png


I think the logic to go about is:

If(isUserAdminSPList, <view all gallery items>, <filter only current user items>)

If(isUserCMSPList, <view all gallery items for the 5 project sites>, <filter only current user items>)




Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi @Alois ,

    Firstly, do this OnStart

    Set(varUser,User());
    Set(
     varUserDetails,
     LookUp(
     'User Role',
     User.Email=varUser.Email
     )
    );
    Set(
     isUserAdminSPList,
     varUserDetails.Role.Value = "Administrator"
    );
    Set(
     isUserCMSPList,
     varUserDetails.Role.Value = "Construction Manager"
    );
    Set(
     isUserPMSPList,
     varUserDetails.Role.Value = "Project Manager"
    );
    Set(
     isUserBUHSPList,
     varUserDetails.Role.Value ="BUH"
    )

    then your gallery Items

    Sort(
     Filter(
     'PTC Logistics Records', 
     Status.Value = "Pending" &&
     (
     isUserAdminSPList ||
     (
     'Project Site'.Value = varUserDetails.Sitel.Value || 
     'Project Site'.Value = varUserDetails.Site_x0020_2.Value || 
     'Project Site'.Value = varUserDetails.Site_x0020_3.Value || 
     'Project Site'.Value = varUserDetails.Site_x0020_4.Value || 
     'Project Site'.Value = varUserDetails.Site_x0020_5.Value
     )
     ) 
     ),
     YourSortField,
     Descending
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

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

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard