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) ?? In my case, when the user selects a person from list B in the combobox, it should save the selected as a Person into List A but also should allow to display the photo of the selected person in a separate image control. Both SP lists A and B have a Person column however, if my Combobox Items property has:
Distinct(Filter([@POCs], Role.Value="Assistant" && IsActive.Value = "Yes"), POC_Person.DisplayName)
then the end result is that the combobox shows those names and allow selection from List B (POCs) but the selected it is no longer a full Person schema (i.e., my image control could not extract the Picture from the combobox selected property). I only see combobox.Selected.Results but not combobox.Selected.Email, .DisplayName, ,Picture etc as example.
Solved! Go to Solution.
Hi @Rico36
Sorry for the late response. And took a while to find out the answer. This is not straightforward also.
Set Onvisible property of the screen to
Clear(colPersons);
ForAll(
With(
{_Item: [@POCs]},
Filter(
_Item,
Role.Value = "Assistant" && IsActive
)
),
Collect(
colPersons,
ThisRecord.POC_Person
)
);
And Set Items Property of Combobox to
colPersons
Set the Layout as Person
Thanks,
Stalin
Hi @Rico36
Set the Items property and DefaultSelectedItems property of Combobox2 to
Distinct(Filter(SPList, 'PersonColumnName'.DisplayName=ComboBox1.Selected.Result).'PersonColumnName','PersonColumnName'.DisplayName)
And Set Onchange property of Combobox 1 to
Reset([@ComboBox2])
Thanks Stalin. Interesting solution but what if the selected person is in POCs but not in SPList.PersonColumnName yet? Also, there is only one combobox.
Hi @Rico36
Hi @Rico36
Since you are expecting a person record (full information), avoid using distinct on the person combobox.
Person combo box can be
Office365Users.SearchUser({searchTerm: ""})
or
Choices(SPList.PersonColumn)
Using these we can use Filter to filter the SPlist person (s)
Thanks Stalin . However, if I use the Filter command:
Filter([@POCs].POC_Person)
then it won't accept necessary filter conditions..: Role.Value="Assistant" && IsActive.Value = "Yes".
If I use the following Filter command instead:
Filter([@POCs], Role.Value="Assistant" && IsActive.Value = "Yes").POC_Person
shows nothing in the combobox because the returned in POC_Person are of type Records. If I add ".DisplayName" at the end it doesn't recognize it as valid. That is why I was using the Distinct().
Distinct(Filter([@POCs], Role.Value="Assistant" && IsActive.Value = "Yes"), POC_Person.DisplayName)
Let me work on this and get back to you.
Hi @Rico36
Sorry for the late response. And took a while to find out the answer. This is not straightforward also.
Set Onvisible property of the screen to
Clear(colPersons);
ForAll(
With(
{_Item: [@POCs]},
Filter(
_Item,
Role.Value = "Assistant" && IsActive
)
),
Collect(
colPersons,
ThisRecord.POC_Person
)
);
And Set Items Property of Combobox to
colPersons
Set the Layout as Person
Thanks,
Stalin
Hi Stalin. Thank you so much for all your time helping me on this. I will try your solution using a collection and will comment back.
Stalin, it worked beautifully !!! Pretty simple too. Thanks so much. 😀
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
183 | |
46 | |
46 | |
34 | |
33 |
User | Count |
---|---|
260 | |
87 | |
79 | |
68 | |
67 |