Hi all.
In brief, I am trying to patch a record to a SharePoint List with multiple columns. One of the columns is a People column.
I use the Office365Users connector.
I have a form with a combo box for 'User', with items fed by the Office365Users connector. If I manually select the user from the combo dropdown, this patches correctly to the SharePoint List along with other info.
When I try to set a default for the combo box for the current user, this does not patch anything to the People column in the SharePoint List unless I manually change the entry.
Below are the details
Combo box Items:
Filter(
Office365Users.SearchUser({searchTerm: cboUser.SearchText}),
AccountEnabled = true && Not("#EXT#" in UserPrincipalName)
)
Combo box DefaultSelectedItems:
CurrentUser
UpdateContext({
CurrentUser: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(User().Email),
Department: "",
DisplayName: User().FullName,
Email: User().Email,
JobTitle: ".",
Picture: "."
}
})
Patching code extract, where cboUser is the relevant combo box:
Patch(
InnovationPortal_Ideas,
Defaults(InnovationPortal_Ideas),
{
Title: txtTitle.Text,
Short_description: txtShortDesc.Text,
Long_description: txtLongDesc.Text,
Status: cboStatus.Selected,
Submitted_date: dateSubmitted.SelectedDate,
User:{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
Claims: cboUser.Selected.Mail,
Department: "",
DisplayName: cboUser.Selected.DisplayName,
Email: cboUser.Selected.Mail,
JobTitle: " ",
Picture: " "
},
Category: cboCategory.SelectedItems,
IsNew: true
}
);
The default itself appears correctly in the combo box, but it's clearly not correctly set as it doesn't match what the SharePoint List column needs fed to it when patching, whereas manually reselecting the same name does work fine.
I'm guessing this is because the 'currentuser' context variable is pulling from the Power Apps current user using User() and this doesn't necessarily match up with the Office365 Users despite seeing the same data and columns. If that's the case, I'd appreciate a suggestion for a better way of pulling the current user details in a way that matches the Office365Users connector and the People column in the SharePoint List.
Any help much appreciated!