How to display values of Person column of SharePoint list in a PowerApps combobox control

This is an interesting scenario and infact turned out to be tougher than I thought. Let’s look at the requirement first.

I have a List in SharePoint which a Person column – Approver1. Screenshot below for reference.

How to show values from Person column of SharePoint list in a combobox

All I need is to show the values from Approver1 field in a combobox inside canvas app. Seems like a fairly simple requirement.

I insert a combobox control on my screen in Canvas app. Few basic things I do. First set the Items property of the combobox to the following formula. ‘Sample List’ is the name of my SharePoint list.

Choices('Sample List'.Approver1)

And then set the Layout of the combobox to Person.

How to show values from Person column of SharePoint list in a combobox

And I thought that was it. Unfortunately it didn’t work. My requirement was to allow the users to select an value from the list of available options. Below is the observed behavior.

Surprisingly the combobox is allowing to select any user available irrespective of whether they are present in the Approver1 field of the list. I am able to select “MOD Administrator” and “Everyone except external users” even though they are not in Approver1 field.

Since it didn’t work, I decided to change the Items formula. I set it to the below formula. The App checker does not show any error.

How to show values from Person column of SharePoint list in a combobox

Now when I run the app, it seems like it show three items. But I could not see any value in there. So this does not solve the purpose too.

Searched the heck out of google and could not come with a proper solution. Finally after a long drawn struggle, this is what I did.

OnVisible of the screen, I created a collection to store the list of values in Approver1 field. You can do it in other places as well like OnStart of App or wherever you find it OK.

How to show values from Person column of SharePoint list in a combobox

Now set the Items property of the combobox to Approver1List collection. And then we start seeing as expected.

How to show values from Person column of SharePoint list in a combobox

But we still have a problem. Observe that items are duplicated in the list. John C appears twice (highlighted in yellow).

For that, change the Items formula to below.

GroupBy(Approver1List, "DisplayName", "Email", "Picture", "Claims", "grpApprovers") 

And now everything works as expected.

Before I end this blog, a very important thing to note here – This procedure described here will only work for if “Allow multiple selections” is unchecked.

How to show values from Person column of SharePoint list in a combobox in Power Apps.

Hope this helped! You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading