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 

3 REPLIES 3
KrishnaV
Super User III
Super User III

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.  

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,291)