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 / User Access using App
Power Apps
Answered

User Access using App

(0) ShareShare
ReportReport
Posted on by 82

Trying to restrict user access at company level.

 

I have created a SharePoint List as below:

One user can handle multiple companies as well.

 

CompanyEmail ID
ABCdef@xyz.com
DEFdef@xyz.com
JKLqrs@hij.com
YTUiop@edf.com

 

I have a gallery control to display details. How can I filter this gallery control to show details only for the companies the logged in user belongs to?

 

This is what I have done - 

 

 

 

 

If(LookUp(DataSource,Title=User().Email,Companies) <> Blank(),ClearCollect(CompanyAccess, ShowColumns(Gallery9.AllItems,"Companies")),Notify("Please contact Admin for access"));

 

 

 

This is storing all the companies which the logged in user belongs to.

 

The gallery control is not filtering. This is what I have done on Gallery Control Items Property - 

 

 

 

Filter(IAForm, StartsWith(Ref_ID,TextInput1_2.Text) ,Company.Value in ForAll(CompanyAccess,Company))

 

 

 

 If the collection contains a single value it filters using below:

 

 

Filter(IAForm, StartsWith(Ref_ID,TextInput1_2.Text) ,Company.Value in CompanyAccess))

 

 

But if it contains multiple values it does not (one user can belong to multiple companies) which is what I am looking for.

 

Please advise.

 

@RandyHayes @WarrenBelz 

 

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    Hi @PowerDigitize_1 ,

    Have you tried simply

    Filter(
     IAForm, 
     StartsWith(
     Ref_ID,
     TextInput1_2.Text
     ) &&
     Company.Value in CompanyAccess.Company
    )

    I am assuming Company is a Text field in the collection and a single choice in the List ?

     

    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

  • PowerDigitize_1 Profile Picture
    82 on at

    Thanks @WarrenBelz 

     

    When I add multiple filters like below, it shows me all the companies- 

     

     

    Filter(
     IAForm,
     StartsWith(
     Ref_ID,
     TextInput1_2.Text
     ) && Company.Value in CompanyAccess.Companies && Not(Ref_ID exactin Gallery1_6.AllItems.Title) Or Not(Ref_ID exactin Gallery1_7.AllItems.Title)
    )

     

    Basically trying to display only those records in gallery:

    • Ref No starts with TextInput1_2.Text // search text box
    • Company.Value = CompanyAccess.Company //Collection
    • If Ref No does not exist in Gallery1_6 or in Gallery1_7
  • PowerDigitize_1 Profile Picture
    82 on at

    Got it!

     

    Filter(
    IAForm,
    StartsWith(
    Ref_ID,
    TextInput1_2.Text
    ) && Company.Value in CompanyAccess.Companies , Not(Ref_ID exactin Gallery1_6.AllItems.Title) Or Not(Ref_ID exactin Gallery1_7.AllItems.Title)
    )

  • WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    @PowerDigitize_1 ,

    Apart from using in rather than exactin, what does the code you posted last not do?

  • PowerDigitize_1 Profile Picture
    82 on at

    I replace && before Not to ,

  • WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    @PowerDigitize_1 ,

    So is it working now?

  • PowerDigitize_1 Profile Picture
    82 on at

    Yes 🙂

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard