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

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

 

 

 

Hi @Nate167 ,

 

You would need to create two collections and then merge them to use that that in your Gallery Control.

ClearCollect(colAccountManager, <Your Filter Formula>)

ClearCollect(colSalesManager, <Your Filter Formula>)

ClearCollect(colManagers, colAccountManager, colSalesManager)

 

Then use "colManagers", in your Items property for Gallery Control.

 

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 very much for this!  I have added the code you suggested to the canvas but can't seem to get the 2 DisplayName errors to go away.  Do you have any suggestions?  

 

Nate167_0-1598026408113.png

Nate167_1-1598026460294.png

 

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,795)