cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filter based upon Person/Group field matching Current User

I have a PowerApp with a SharePoint list as datasource.  I want to do the following:

 

Filter the list display in Gallery based on the following test:  Show the list of records for which the current user is listed as the product manager.  The Product Manager field is populated from a Person/Group field in the SP List.  I'm having a hard time doing this, as it seems to be a mismatch of field types.  It actually works if I search on email for current user and = it to email of Product Manager, but it doesn't actually filter anything.  

 

Thanks!

Carole 

5 REPLIES 5
KrishnaV
Super User
Super User

Hi @Anonymous ,

 

Try this:

Filter(SPListName, User().Email in Productmanager.email) // This works only for single people picker selection
Filter(SPListName, User().Email in Concat(Productmanager,Email&",") // This works only for single people picker selection


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more. 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
v-qiaqi-msft
Community Support
Community Support

Hi@CaroleKV,

Based on the issue that you mentioned, do you want to filter the gallery based on the user?

Combine that with your description, you want to check if the current user exists in the Product Manager column, if it does, filter the gallery based on the Person/Group column.

Thanks for @KrishnaV posting a solution. I will make some addition to this issue. As an alternative solution, you can try the formula below.

  • Set the OnVisible property of the screen as below

 

Set(CurrentUser,User().Email)​

 

  • Set the Items property of the gallery and call the variable.

 

Filter(DataSource,PersonColumn.Email = CurrentUser)​

 

Note: If this can not solve your issue, please post some screenshots about the error message.

 

Best Regards,

Qi

Best Regards,
Qi
Anonymous
Not applicable

The problem I couldn't get around was that the User record type is not the same as the Person record type at all.  And the person type turns the name into LastName,First instead of First Name Last Name, so it was never matching.  I got around this by using the Office365User data connection, and converting the name into LastName, First so it would find a match.  That solved the problem.  My other problem was that this code is amongst a whole bunch of other Filter and Search code on that same gallery, so it was hard to even figure out where to put it, much less what it should be.  

this does not work with the Concat ..

how can this be done?

need this to work if the Sharepoint Person field can hold multiple users.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,104)