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

Patching ComboBox Items to Multi-Select People Picker Column in SharePoint

Hello All,

 

I am working on making a submission screen so that our Project Managers can record the participants of their weekly toolbox talks.

 

I have tried several formulas to try and patch the selected items (users) to my SharePoint list, but have been unable to successfully. I have only been able to patch the first selected user or, in some cases, none at all. 

 

This is my current placeholder formula until I can find the right one:

 

Patch('Toolbox Talks Submissions',
Defaults('Toolbox Talks Submissions'),
{
Toolbox_x0020_Talk:{
Id: Gallery10.Selected.ID,
Value: Gallery10.Selected.TalkTitle
},
Participants: Gallery7_2.AllItems,
Usefulness: {Value: Radio1_21.Selected.Value}
}
)

 

I have also tried this formula to patch the participants:

 

ForAll(ComboBox1_1.SelectedItems,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & Mail,
Department:"",
DisplayName: DisplayName,
Email: Mail,
JobTitle:"",
Picture:""
})

 

This also did not work.

 

Is there a way to patch multiple selected people to a multi-select people picker column in SharePoint?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Creechyy 

I would consider changing the Items property to:

    Filter(Office365Users.SearchUserV2({searchTerm:"",top:35}).value, Department="Job Site")

As the SearchUser action has been deprecated.

 

For your Patch formula, it should be the following:

Patch('Toolbox Talks Submissions',
    Defaults('Toolbox Talks Submissions'),
    {
      Toolbox_x0020_Talk: {Id: Gallery10.Selected.ID, Value: Gallery10.Selected.TalkTitle},
      Participants: 
           ForAll(ComboBox1_1.SelectedItems,
               {Claims:"i:0#.f|membership|" & Lower(Mail),
                Department:"",
                DisplayName: DisplayName,
                Email: Mail,
                JobTitle:"",
                Picture:""
               }
           ),
      Usefulness: {Value: Radio1_21.Selected.Value
    }
)

Assuming that Toolbox Talk is a Lookup column and Usefulness is a Choice column and, of course, that your Participants column is a multi-select person column.

_____________________________________________________________________________________
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
RandyHayes
Super User
Super User

@Creechyy 

First, what is the Items property of Combobox1_1 ?

Next, in one formula you are trying to patch the column with AllItems from a Gallery - is that intentional?  I am not sure where your Gallery fits into this.

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

The Items property of ComboBox1_1 is this:

 

Filter(Office365Users.SearchUser({searchTerm:"",top:35}),Department="Job Site")

 

And yes the Gallery is there to display the people that have been selected. In that formula, I placed it there as a holder. 

This is what the screen currently looks like:

 

InkedInkedInkedscreenshot-us.create.powerapps.com-2021.06.14-10_38_25_LI.jpg

RandyHayes
Super User
Super User

@Creechyy 

I would consider changing the Items property to:

    Filter(Office365Users.SearchUserV2({searchTerm:"",top:35}).value, Department="Job Site")

As the SearchUser action has been deprecated.

 

For your Patch formula, it should be the following:

Patch('Toolbox Talks Submissions',
    Defaults('Toolbox Talks Submissions'),
    {
      Toolbox_x0020_Talk: {Id: Gallery10.Selected.ID, Value: Gallery10.Selected.TalkTitle},
      Participants: 
           ForAll(ComboBox1_1.SelectedItems,
               {Claims:"i:0#.f|membership|" & Lower(Mail),
                Department:"",
                DisplayName: DisplayName,
                Email: Mail,
                JobTitle:"",
                Picture:""
               }
           ),
      Usefulness: {Value: Radio1_21.Selected.Value
    }
)

Assuming that Toolbox Talk is a Lookup column and Usefulness is a Choice column and, of course, that your Participants column is a multi-select person column.

_____________________________________________________________________________________
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!
Creechyy
Frequent Visitor

I just got an error message:

Screenshot (3).png

 

The record also did not patch to SharePoint whatsoever.

 

I have seen other users that have patched from a temporary collection. I have not used collections that much, but would this be a better solution?

RandyHayes
Super User
Super User

@Creechyy 

No, a collection is of no use in this case, you already have the information you need in your controls, there is no sense in duplicating it again.

Your issue in that formula is with the user from your combobox.  It is telling you that the user does not exist in SharePoint.

Can you narrow down to a particular selected user?  If you select only one user in the combobox and then submit, if you get the error, can you look in the user profiles of your SharePoint admin to see if there is in fact that user or not?

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

It works and you were right! I had a few users added to the admin center that had yet to fully log into their account. It works with those who have. Great solution!! Thank you for all your help.

Hi @RandyHayes ,

i implemented your suggestion in my app but couldnet make it work

when patched im getting an error:  

Perez_0-1656490011160.png

itried to collect the combo box content to use the collection in the patch and i doiiscovered that the collection is empty, the rows are collected but its empty, no data.

my items formula is: Office365Users.SearchUserV2({searchTerm:ComboAI_Owner.SearchText,top:10}).value

my  patch formula is:

Patch('Action Items',
LookUp('Action Items',
ID=ThisItem.ID),
{
Title:TextInput2.Text,
Status:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: DD_Approved_1.SelectedText.Value,
ID:ThisItem.ID},
Open_x0020_Date:ThisItem.Open_x0020_Date,
/* RiskID:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: ThisItem.RiskID,
ID:ThisItem.ID},*/
Due_x0020_Date:DueDate2_2.SelectedDate,
AI_x0020_description:txtAI_Description.Text,
Notifications:Checkbox1.Value,
Assigned_x0020_to:ForAll(ComboAI_Owner.SelectedItems,
{Claims:"i:0#.f|membership|" & Mail,
Department:"",
DisplayName:"",
Email: "",
JobTitle:"",
Picture:""
})
}
)

if any additional data required, i will be happy to provide

will appreciate your response.

Eyal

 

 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

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

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,850)