Populate a Combobox Person field with a filtered list of people

Recently, one user posted a question on the PowerApps community forum to get an answer. When I was reading the subject and content then thought that was an easy solution until I tried to reproduce it.

User Question

How can I populate a Person’s Combobox field linked to a column in SP list “A” exclusively with a filtered list of people from list “B” and still allow that Combobox to remain full person schema? (can extract email, picture, etc) ??

SP List Structure

User Requirement

Filter POC_Person when Role = “Assistant” and IsActive = True

I thought this is a simple filter and started to reproduce and came to know this is not straightforward.

Common Mistake  or Assumption

Most of them including me to start to filter like below

Filter(_item,Role.Value = “Assistant” && IsActive).POC_Person

Filter(Choices([@POCs].POC_Person),Email in (Filter(…..))

No…No…

Solution

We need to loop through the filter and collect the Person field. So we can’t directly do this filter on the Items property of Combobox. 

  • Set OnVisible property of the screen to

  • Set Items Property of Combobox to

  • Set the ComboBox Layout to Person

 

Result

Conclusion

We are able to filter the Person field with Person layout so that we can extract user properties like Displayname, Email, and JobTitle

Clear(colPersons);
ForAll(With({_Item: [@POCs]},
Filter(_Item, Role.Value = “Assistant” && IsActive)),
Collect(colPersons,ThisRecord.POC_Person));

 

Leave a Reply

Your email address will not be published.