Display Multi-Select Person or Group in PowerApps.

I was responding to the PowerApps forum recently, saw the requirement, and decided to write a blog about it. So what is that?

Requirement

Display Person names in a combo box. The source is SharePoint and Multi-select person or group field. The requirement is to maintain the Person or Group Type to keep all properties like (DisplayName, Email, Department, Claims, and Job Title).

SharePoint-MultiSelect-Person

Expected Output (Combo Box)

Display Distinct Person from this MultiPeople column from Sharepoint

The person column is always unique, and Multi-Select involves more challenges. Initially, I thought to ungroup it, but Distinct and Sort won’t work until we do some tricks.

Combo Box

Set the items property of the Combo Box to 

With({Items: Ungroup(ForAll(SPList,MultiplePeopleColumn),”Value”),
DistinctEmail:Distinct(Ungroup(ForAll(SPList,MultiplePeopleColumn),”Value”),Email)},
Sort(
ForAll(DistinctEmail,First(Filter(Items,Email=Value))),
DisplayName
)
)

References (New–> Replace Result to Value)

Conclusion

We can display the Person or group in the combo box using the With function and maintain the Person Type. 

10 comments

  1. This entry was really helpful. One note about an addition I had to make to get it to work for me. It looks like it ends up displaying whatever might be set up in the system as the first column of data, in our case it was the Claims column. I had to add a .DisplayName at the end and then it started showing the DisplayName in the dropdown for me.

  2. Thanks so much! My use case was a single person selection – so I had to remove the Ungroup( ) function. but – then it works!

    With({Items: ForAll(‘License Tracking List’,Employee),
    DistinctEmail:Distinct(ForAll(‘License Tracking List’,Employee),Email)}
    ,
    Sort(
    ForAll(DistinctEmail,First(Filter(Items,Email=Result))),
    DisplayName
    )
    )

  3. I am trying this and is not working , guess i am missing something, what is value ?

    With({Items: ForAll(‘images Trials’;Rep);
    DistinctEmail:Distinct(ForAll(‘images Trials’; Rep); Email)}
    ;
    Sort(
    ForAll(DistinctEmail; First(Filter(Items; Email=Result)));
    DisplayName
    )
    )

  4. what about Multi-select people picker? How to set defaultselectedItems property for this field when we are looking to bind data?

  5. Thanks man it´s works I just change a result for value

    With(
    {
    Items: Ungroup(ForAll(SP_List; ColumnPerson_Name); “Value”);
    DistinctEmail: Distinct(Ungroup(ForAll(SP_List; ColumnPerson_Name); “Value”); Email)
    };
    Sort(
    ForAll(DistinctEmail; First(Filter(Items; Email = Value)));
    DisplayName
    )
    )

    I appreciate your help a lot!!

Leave a Reply

Your email address will not be published. Required fields are marked *