cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JMUSharePoint
Frequent Visitor

Filter a People Picker in a SharePoint List based on another value in the same list.

I have a list in SharePoint (called Reviewers) as a data source with a field called Reviewer which is a people picker field.  I have another field in the same list called DefaultNotification with a value of "Primary".  I have the Reviewer field on the form and I want to set the default value to the row in the list where the person is the Primary contact.  I can't figure out how to set the default to that person.  I've found other sources that shows how to filter a list for a text field with a specific value but I haven't found one that will filter out a person based on another value in the form

 

List Name: Reviews

 Fields : Reviewer (people picker)

Default Notification (text field), only one will say Primary

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@JMUSharePoint 

First, make sure your Default on the DataCard hosting that Combobox is set the : ThisItem.AssignedTo (adjust the AssignedTo to reflect the proper name in your datasource).

 

Next, set the DefaultSelectedItems property of your Combobox to the following:

Coalesce(Parent.Default, LookUp(Reviewers, DefaultNotification = "Primary", Reviewer))

 

That should give you what you are looking for.

I hope this is helpful for you.

 

_____________________________________________________________________________________
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

8 REPLIES 8
jbrit2020
Continued Contributor
Continued Contributor

You have a gallery as people picker and a textbox where you start inputing the person's name and you want to return only primaries? you will have to add a Filter() somewhere in there, can you share a screenshot of the app and the code you have for the items of that gallery?

I don't have a gallery in the form but the list is a data source.  Can I not filter the list directly in the default value of the people picker or do I need the gallery and filter it there and then set the default value on the people picker field to that record.  There will only be one that will be identified in the list as the Primary contact.

 

jbrit2020
Continued Contributor
Continued Contributor

Perhaps you can, can you show a screenshot of the code you have for your people picker?

 

jbrit2020
Continued Contributor
Continued Contributor

.

I don't have anything on the Default property at the moment.  Here are screenshots of my Reviewer list, the form, and my data sources. 

JMUSharePoint_1-1610473885345.png

JMUSharePoint_2-1610473936586.png

 

The field I want to set a default person is the Assigned to field in the Reviewers data source, from the Reviewer column where the value in the column Default Notification is equal to Primary.

 

JMUSharePoint_3-1610474001019.png

 

 

 

 

 

 

 

jbrit2020
Continued Contributor
Continued Contributor

If that is a dropdown box then on Item put this:

 

Filter('Reviewer', Default Notification= "Primary") then in Value in properties select the field you want to see.

 

 

 

RandyHayes
Super User
Super User

@JMUSharePoint 

First, make sure your Default on the DataCard hosting that Combobox is set the : ThisItem.AssignedTo (adjust the AssignedTo to reflect the proper name in your datasource).

 

Next, set the DefaultSelectedItems property of your Combobox to the following:

Coalesce(Parent.Default, LookUp(Reviewers, DefaultNotification = "Primary", Reviewer))

 

That should give you what you are looking for.

I hope this is helpful for you.

 

_____________________________________________________________________________________
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!

I just now saw this updated message and it worked perfectly.  Thank you so much.  I've spent hours trying to find a solution.

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 (3,586)