Patch(
appliedleave, // Data source to patch
Defaults(appliedleave), // Record to modify (if it exists) or new record (if it doesn't exist)
{'Leave Type': Gallery3.Selected.'Leave Type'.Value}, // Update the 'Leave Type' field with the value selected in Gallery3
{'From Date': 'from date'}, // Update the 'From Date' field with the value 'from date' (this should be a variable or control)
{'To Date': 'to date'}, // Update the 'To Date' field with the value 'to date' (this should be a variable or control)
{'Leave Title': TextInput1}, // Update the 'Leave Title' field with the value from TextInput1
{'Leave Description ': TextInput1_1}, // Update the 'Leave Description' field with the value from TextInput1_1
{ // Update the 'Requested By' field with user information
RequestedBy: {
'@odata.type': "#Microsoft.Azure.Connectors.Sharepoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(User().Email),
Department: "",
DisplayName: User().FullName,
Email: User().Email,
JobTitle: ".",
Picture: "."
}
},
{
RequestedTo: {
'@odata.type': "#Microsoft.Azure.Connectors.Sharepoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(_selectedapprover.Mail),
Department: "",
DisplayName: _selectedapprover.DisplayName,
Email: _selectedapprover.Mail,
JobTitle: ".",
Picture: "."
}
}
this is my code for a button. the gallery and the gallery item contains the code:
ClearCollect(_selectedapprover,Gallery4.Selected);
UpdateContext({_showSelectApprover:false})
the error message is:

please help me through this.
Thank you