Reputation: 75
I am trying to implement a like feature in Microsoft power apps. I am having an issue when pressing the like button I am receiving the error
The type of this argument "LikedBy" does not match the expected type "Record" found type "text" instead.
The code I am using is
Patch(
ProposalLikes,
Defaults(ProposalLikes),
{
ThemeID: ThisItem.ID,
Liked: 1,
LikedBy: User().Email
}
)
and my structure data list looks like
does anyone know why I am receiving this error?
Upvotes: 0
Views: 1282
Reputation: 4405
It appears that LikedBy
is a Person-type column in the Sharepoint list. If so, it is a Record data type whereas User().Email
is a Text data type. It can be tempting to use User()
to patch Person-type columns, but the schemas don't match.
Person-type Column Schema (Sharepoint):
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|[email protected]",
Department:"",
DisplayName:"",
Email:"",
JobTitle:"",
Picture:""
}
To Patch a Person-type Column, Try this:
Patch(
ProposalLikes,
Defaults(ProposalLikes),
{
ThemeID: ThisItem.ID,
Liked: 1,
LikedBy:
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:"",
Picture:""
}
}
)
Upvotes: 0