To patch a record of type Person from a collection to a SharePoint list, you need to handle the person field correctly in both the collection and when patching to SharePoint. The person field in SharePoint is a complex field that typically requires the Claims value of the user. When you're using a ComboBox to select a person from the Office365Users connector, you're working with a record that includes various properties of the user, but SharePoint specifically needs the Claims identifier for the person field.
When you add a user to the collection, ensure you're storing the necessary information to later patch to SharePoint. This often means storing the Claims value or the primary email of the user, which can be used to construct the Claims value.
Patch(
colItemsV2,
ThisItem,
{
// Other fields...
RequestedFor: {
Claims: "i:0#.f|membership|" & cb_UserSearch.Selected.Email,
DisplayName: cb_UserSearch.Selected.DisplayName
},
// Other fields...
}
);
Step 2: Patching to SharePoint
When you patch the collection to SharePoint, you need to use the Claims value you've stored in the collection. Assuming you've stored the Claims or the email in the RequestedFor field as shown above, you can reference it directly.
ForAll(
colItemsV2,
If(
!IsBlank(Item),
Patch(
'Procurement Request Line Items',
Defaults('Procurement Request Line Items'),
{
Title: Item,
RequestedFor: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: RequestedFor.Claims
},
// Other fields...
}
)
)
);
ForAll(
colItemsV2,
If(!IsBlank(Item),
Patch(
'Procurement Request Line Items',
Defaults('Procurement Request Line Items'),
{
Title: Item,
RequestedFor: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(YourDropDownOrComboPerson.Selected.Claims),
Department: "",
DisplayName: "",
Email: "",
JobTitle: "",
Picture: ""
},
Cost: Cost,
WarrenBelz
146,702
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,015
Most Valuable Professional