cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nate167
Helper II
Helper II

Filtering SP List with people picker by current user

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)

 

12 REPLIES 12
pawanjajoo
Resolver I
Resolver I

Hi @Nate167 ,

 

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.

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

 

 

Hi @Nate167 ,

 

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.

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.  

Hi @Nate167 ,

 

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.

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

Nate167_1-1597863260645.png

 

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.

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

 

 

 

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.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,348)