All,
I am creating a Leave Request application on Power Apps and using SharePoint List as source for all the tables.
I am able to connect and show all the data from List. So, the connections are working fine as I am able to see all the information in the galleries.
But the at the end, when a user wants to submit a leave request, I am using Patch function to input information into a list. I have also tested my query which is working fine but when I test in both Preview and published version of the app I am getting below error.
(For some reason, I am not able to upload an image!!)
Below is my code for patch to SP List.
Patch(
LeavesAppliedByUsers,Defaults(LeavesAppliedByUsers),{LeaveType: Gallery4.Selected.LeaveType.Value,FromDate: StartDate.SelectedDate,ToDate: EndDate.SelectedDate,LeaveTitle: txtLeaveTitle.Text,LeaveDescription: txtLeaveDesc.Text,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),DisplayName: _selectedApprover.DisplayName,Email: _selectedApprover.Mail,Department: "",JobTitle: ".",Picture: "."}})
The error I get:
"Network error when using Patch function: An error occurred on the server."
When I further did tests in the app using Monitor, I got below errors.
| Category | Operation | Result | Result Info | Status | Data Source | Control | Property |
| UserAction | Select | Success | | | | Button3 | OnSelect |
| --- | --- | --- | --- | --- | --- | --- | --- |
| UserAction | Select | Success | | | | SubmitButton | OnSelect |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Data Operation | patchCreateRow | Success | Patch Request Payload | | | SubmitButton | OnSelect |
| Network | CreateRow | Error | Bad Gateway | 502 | LeavesAppliedByUsers (List) | SubmitButton | OnSelect |
| Function | Patch | Error | Network error when using Patch function: An error occurred on the server. | | | SubmitButton | OnSelect |
| Runtime | Unhandled error | Error | Network error when using Patch function: An error occurred on the server. | | | SubmitButton | OnSelect |
Can someone please assist with the above issue? Let me know if you need more information.