PATCH A SharePoint Person Column With Multiple People In Power Apps



Goal

Change the EmployeePeople column (Person Type) from blank to “Matthew Devaney”, “Sarah Green” and “David Johnson” in a SharePoint list.


Input

Project Tasks (SharePoint List)

IDTaskNameDueDateEmployeePeople
1Write project plan11/7/2020


Patch Function Code
Patch( 'Project Tasks', LookUp('Project Tasks', ID=1), { EmployeePeople: Table( { '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims: "i:0#.f|membership|[email protected]", Department: "", DisplayName: "Matthew Devaney", Email: "[email protected]", JobTitle: "", Picture: "" }, { '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims: "i:0#.f|membership|[email protected]", Department: "", DisplayName: "Sarah Green", Email: "[email protected]", JobTitle: "", Picture: "" }, { '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims: "i:0#.f|membership|[email protected]", Department: "Technology", DisplayName: "David Johnson", Email: "djohnson@companyname", JobTitle: "", Picture: "" } ) } )Code language: JavaScript (javascript)


Output

Project Tasks (SharePoint List)

IDTaskNameDueDateEmployeePeople
1Write project plan11/7/2020Matthew Devaney
Sarah Green
David Johnson




Scenario #1: ComboBox

Patch a value found in a combo box to a People field.



ComboBox Properties Code
Items: Choices('PATCH Function Examples'.EmployeePeople) DisplayFields: ["DisplayName"] SearchFields: ["DisplayName"]Code language: JavaScript (javascript)


Patch Function Code
Patch( 'Project Tasks', LookUp('Project Tasks', ID=1), { EmployeePeople: ComboBox_Person.SelectedItems } )Code language: JavaScript (javascript)