Share via

PowerApps - LeaveRequest Form: "Network error when using Patch function: An error occurred on the server."

Anonymous
2024-01-22T00:12:08+00:00

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.

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-01-22T04:06:00+00:00

    Thanks, Mia, for providing the link to PowerApps Community. I have posted my question in the appropriate forum there.

    As for your links, I have already checked both the solution before and that does not seem to be the issue in my case.

    Thanks again.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-01-22T00:26:14+00:00

    Dear and respected,

    Good morning!!

    I understand your concern, and as far as I know, you can try to check the SharePoint list permissions and let other users try if they will encounter the same error message.

    While we want to offer more support since it's related to the Power Apps coding and community moderators here focus on out-of-box features in SharePoint so we have limited experience of Power Apps customization, I suggest you post your concern in the Power Apps Community - Power Platform Community (microsoft.com)

    Apologies for redirecting you to a different community as category members have limited knowledge about Power Apps, to get the best and fastest assistance, we redirect you the right way.

    Here are some similar threads I found for you in that community:

    1.Solved: Network error when using the Patch Function: An er... - Power Platform Community (microsoft.com)

    2.network error when using patch function : an error... - Power Platform Community (microsoft.com)

    Appreciate their patience and understanding. Have a great day!

    Best regards

    Mia

    Was this answer helpful?

    0 comments No comments