cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SachS
Helper II
Helper II

SharePoint list item 'Created' user's name as items in a Combo Box

I am building a PoweApp with a Share Point List (similar to their default Issue Tracker) as the source. I would like to present the user to filter a gallery by the name of the items' creator. I know you can do this easily for 'Choice' columns in SharePoint Lists by setting the Items property of the ComboBox to the following (below example when I want to filter by Status)

ComboBox.Items = Choices('Issue Tracker'.Status)

 

However, if I try the same method with the 'Created' column (which is a column of type "Person or Group"), like so:

ComboBox.Items = Choices('Issue Tracker'.'Created By')

I get a list of items of the format:

c:0o.c|federateddirectoryclaimprovider|<some guid>	

 

I tried 

ComboBox.Items = Choices('Issue Tracker'.'Created By'.DisplayName)

but it doesn't recognize the 'DisplayName' portion of the item.

 

 

Is there a way to get the user name to a combo box so that I can filter a gallery?

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@SachS 

Yes, so what you want is something that Choices will not provide.  Choices for user columns will return the SharePoint users/groups.

 

If you want just the list of currently existing users, then your formula for the Items property would be the following:

Distinct('Issue Tracker', 'Created By'.DisplayName)

This will show just the users that have created a record in the list.  Note...DisplayName ONLY.  If you need more information on the user than Display Name, then the formula needs adjustment.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
RandyHayes
Super User
Super User

@SachS 

 What you want is:

Choices('Issue Tracker'.'Created By')

However, you are most likely seeing the Claims column of those records, so change your DisplayField to DisplayName.

Or choose the layout of the Person type as shown in green above to give a more robust list.

 

I hope this is helpful for you.

 

RandyHayes_0-1645812776514.png

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

Yes, I was using 'Created By' column - as shown in the code sample I posted - the mentioning of 'Created' in the title was a typo.

 

However, when I try your method I still get an unexpected result. I created a gallery and simply set:

MyGallery.Items = 'Issue Tracker'

Then, in each item, I set 'Title' field to 'Created By'.DisplayName:

title.png

 

This works fine, and in the Gallery I can see the names of the ticket creators:

gallery.png

 

However, when I set ComboBox.Items to Choices as below:

ComboBox.Items = Choices('Issue Tracker'.'Created By')

and set the data card to look like this:

datacard.png

My ComboBox shows:

cmbdetails.png

which are some of the Email distributions in our company. Seems the Choices option isn't pulling the user data but data from groups/distributions they belong to?

 

 

RandyHayes
Super User
Super User

@SachS 

Yes, using the Created By column will include not only users but groups as well.  If you perform a search in your combobox for a user, you will see that users will be shown as well.

I would suggest using a Person column that you have made in your list to reference to get SharePoint Users in your combobox.

Keep in mind that the goal of the combobox is NOT to show a list of all the users but to allow the user to type in (search) for users to display.

 

If you are trying to actually show all the users, then you will need to utilize the SearchUserV2 action of the Office 365 Users connector instead.  But, it is important to note that this will return and show records that are Office 365 User records.  SharePoint user records have a different schema and cannot be interchanged directly without conversion.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes I see. That is not quite what the behavior I expected; suppose my IssueTracker has 5 items, created by 3 users, namely UserA, UserB, and UserC.

 

What I want to do is populate the ComboBox/DropDown (I'm fine with using a Drop Down instead of a Combo Box) with unique values of only the users who have created an item in the IssueTracker. So my organization may have hundreds of users, but I don't want to pull data from organization employee records, simply from what's logged as entries under the 'Created By' column in my SP list. In this case, it should only show UserA, UserB, and UserC. Is that possible?

 

I'm not sure how creating a Person column helps - I don't want the users to fill in a 'Created By User' column when submitting a new ticket. I want data from the actual 'Created By' column.

 

RandyHayes
Super User
Super User

@SachS 

Yes, so what you want is something that Choices will not provide.  Choices for user columns will return the SharePoint users/groups.

 

If you want just the list of currently existing users, then your formula for the Items property would be the following:

Distinct('Issue Tracker', 'Created By'.DisplayName)

This will show just the users that have created a record in the list.  Note...DisplayName ONLY.  If you need more information on the user than Display Name, then the formula needs adjustment.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
SachS
Helper II
Helper II

Yes, this is exactly what I wanted, thanks!

RandyHayes
Super User
Super User

@SachS 

Happy to help!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,633)