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 / Filtering SP List with...
Power Apps
Unanswered

Filtering SP List with people picker by current user

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

  I'm working on a project where sales reps can only see their accounts from a SP list.  The accounts in the list are not created by them but they are able to edit the entries.  I have 2 columns in the SP list that are built with people pickers and need the filter to scrub both lists against the current user.  The list needs to be filtered 2 ways; one is when an account rep logs in they only see their accounts, two when a manager logs in they can see all of their reps accounts.  The two columns I'm referencing are "account manager" and "sales manager".  Below is the coding I have so far and any help would be greatly appreciated.  

 

App startup code:  Set(CurrentUser,Office365Users.MyProfile().DisplayName)

 

Browse Gallery Code: Filter('WRFP-2021 Sample','Account Manager'.DisplayName=CurrentUser)

 

Categories:
  • pawanjajoo Profile Picture
    191 on at

    Hi @Anonymous ,

     

    I don't see any issue with the formula that you are using. However, I would recommend to place the Set statement in the "OnVisible" property of the screen instead of "OnStart" property of the App.

     

    If you continue to face issues, please share screenshots.

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have moved the set statement to the on visible portion but can not get results to populate.  I have changed a few of the account manager names to mine and those accounts do not come up when I test run the program.  Below are screen shots please let me know if you need additional screen shots.  

    Nate167_0-1597861096802.png

    Nate167_1-1597861123303.png

     

     

  • pawanjajoo Profile Picture
    191 on at

    Hi @Anonymous ,

     

    Is there more to the formula? if not, I see a closing parenthesis missing for the Filter function.

    I assume that you have mapped the control inside the gallery with a field from your datasource.

     

    To ensure that you are getting your filter data correctly, you can also enable "Enhanced Formula Bar" under Experimental feature from Settings -> Advanced Settings.

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for catching the closing parenthesis I did forget to add it to the formula.  I am still new to powerapps and I don't believe I have mapped my control from the gallery to the field from the database.  I have enabled the "enhanced formula bar as you suggested.   I am able to get results from the SP list and can search them until I want to filter that list by the current user and that's where I'm stuck.  

  • pawanjajoo Profile Picture
    191 on at

    Hi @Anonymous ,

     

    Select your Gallery Control, then in the properties pane, click on Edit Fields and check if your field is mapped to the control. Share a screenshot if possible.

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Here is a screenshot of the fields my gallery is using. 

    Nate167_1-1597863260645.png

     

  • pawanjajoo Profile Picture
    191 on at

    Ok. So your field is mapped correctly to the gallery control. But there are lot of Errors that it shows on the control. Please click on the "App Checker" (stethoscope icon under purple bar). It will show you the error details. If you need help with resolving any particular error, provide the details here.

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have multiple formula and accessibility errors showing.  Most are accessory label errors but I do have 14 formula errors, with 12 being about the browse screen and the formula, and 2 being about the details screen.  I've posted screen shots below for your reference.  

    Nate167_0-1597864313708.pngNate167_1-1597864330168.pngNate167_2-1597864350976.pngNate167_3-1597864354577.pngNate167_4-1597864387805.png

    Nate167_5-1597864446864.png

     

     

     

  • pawanjajoo Profile Picture
    191 on at

    Couple of things you should check:

    1. Office365Users is actually added as a datasource in your app.

    2. In your search function, the search text should be updated as TextSearchBox1.Text. You are missing a closing parenthesis here as well.

     

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your help with this, it is much appreciated!  I have connected Office365users as a data source and it's working now.   One final question, how would I edit the below code to include the "sales manager" column as well.  I want all the accounts to display for the reps under that sales manager when the manager logs in.

     

    Nate167_1-1597868472646.png

     

     

     

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 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard