cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
prabhat007
Level: Powered On

Combobox People Picker in Gallary control

Hi Team,

I am using one custom combobox control in custom gallary. This is my second navigation screen, on screen one I am saving master data in SharePoint list1. On second screen, I have this gallary with people picker combobox, text controls(Email, First Name, Last Name) and I want to prepopulate the gallary controls from SharePoint List2 based on SP List1 master ID. I have Lookup column ini SP List2 referencing SP List1.ID

Also, On screen 2, on clicking save in gallary row, combobox people picker resets to blank.

Also I want to fill in gallary FirstName, Last NAme, Email on change of People Picker combobox. Please help.

4 REPLIES 4
Community Support Team
Community Support Team

Re: Combobox People Picker in Gallary control

Hi @prabhat007,

Could you please share a bit more about your scenario?

Is there a Person type column existed within your SP list 2? Do you want to populate the Person column value from your SP list 2 into the People Picker ComBo Box based on SP List 1 master ID?

I have made a test on my side, please take a try with the following workaround:9.JPG

 

8.JPG

On your side, if you want to pre-populate the Gallery from SP list 2 based on SP List1 master ID, please take a try with the following workaround:

Set the Items proeprty of the Gallery to following:

Filter("YourSPList2", LookUpColumn.Value= MasterIDFromYourSPList1)

Within the Gallery, set the Items property of the People Picker Combo Box to following (Please configure your Combo Box as above screenshot mentioned):

Choices('YourSPList2'.YourPersonColumn)

Set the DefaultSelectedItems property of the ComBo Box to following:

If(
    IsChanged=true,
    {
      '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
       Claims: "i:0#.f|membership|" & Lower(SelectedUser.Email),
       Department: "",
       DisplayName: SelectedUser.DisplayName,
       Email: SelectedUser.Email,
       JobTitle:"",
       Picture:""
    },
    {
      '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
       Claims: "i:0#.f|membership|" & Lower(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email),
       Department:"",
       DisplayName: LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName,
       Email: LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
       JobTitle:"",
       Picture:""
    }
)

Set the OnChange property of the Combo Box  (ComboBox1) to following:

Set(SelectedUser, ComboBox1.Selected);Set(IsChanged, false);Set(IsChanged, true)

Set the Default property of the First Name Text Box to following:

If(
   IsChanged = true,
   First(Split(SelectedUser.DisplayName, " ")).Result,
   First(Split(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName," ")).Result
)

Set the Default property of the Last Name Text Box to following:

If(
   IsChanged = true,
   Last(Split(SelectedUser.DisplayName, " ")).Result,
   Last(Split(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName," ")).Result
)

Set the Default property of the Email Text Box to following:

If(
   IsChanged = true,
   SelectedUser.Email,
   LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email
) 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
prabhat007
Level: Powered On

Re: Combobox People Picker in Gallary control

Hi @v-xida-msft

Thanks for replying and helping.

I have tried this approach but main issue coming onChange of people picker combobox. In my case if I change any combobox people picker, all rows in gallary gets changed with FirstName, LastName and Email. Can you please check at your end and share whether I am missing some ThisItem property to set for each. Thanks

Community Support Team
Community Support Team

Re: Combobox People Picker in Gallary control

Hi @prabhat007,

Just an update -- Please take a try with the following workaround:

Set the Items proeprty of the Gallery to following:

Filter("YourSPList2", LookUpColumn.Value= MasterIDFromYourSPList1)

Within the Gallery, set the Items property of the People Picker Combo Box to following (Please configure your Combo Box as above screenshot mentioned):

Choices('YourSPList2'.YourPersonColumn)

Set the DefaultSelectedItems property of the ComBo Box (ComboBox1) to following:

If(
    ComboBox1.Selected.Email <> LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
    {
      '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
       Claims: "i:0#.f|membership|" & Lower(ComboBox1.Selected.Email),
       Department: "",
       DisplayName: ComboBox1.Selected.DisplayName,
       Email: ComboBox1.Selected.Email,
       JobTitle:"",
       Picture:""
    },
    {
      '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
       Claims: "i:0#.f|membership|" & Lower(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email),
       Department:"",
       DisplayName: LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName,
       Email: LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
       JobTitle:"",
       Picture:""
    }
)

 

Set the Default property of the First Name Text Box to following:

If(
   ComboBox1.Selected.Email <> LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
   First(Split(ComboBox1.Selected.DisplayName, " ")).Result,
   First(Split(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName," ")).Result
)

Set the Default property of the Last Name Text Box to following:

If(
   ComboBox1.Selected.Email <> LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
   Last(Split(ComboBox1.Selected.DisplayName, " ")).Result,
   Last(Split(LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.DisplayName," ")).Result
)

Set the Default property of the Email Text Box to following:

If(
   ComboBox1.Selected.Email <> LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email,
   ComboBox1.Selected.Email,
   LookUp('YourSPList2', ID=ThisItem.ID).YourPersonColumn.Email
) 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
prabhat007
Level: Powered On

Re: Combobox People Picker in Gallary control

Thanks @v-xida-msft, I will try this over weekend and will connect you soon. Thanks