Blog

Forms - When calling SubmitForm, how to debug the error "Network error when using Patch function"

If you receive the error  "Network error when using Patch function", here's a quick demonstration and walkthrough of how to diagnose this error.

I see this problem a lot from app builders - when building forms and calling SubmitForm, Power Apps returns an error that begins "Network error when using Patch function".
 
This can often be confusing - why does Power Apps report an error with Patch when calling SubmitForm? 

How can we find additional error information that can help us pinpoint the error? This post gives a quick walkthrough of how to diagnose this type of problem.

Walkthrough - diagnosing the "Network error when using Patch function" error

To demonstrate, here's an example of a pre-built app that was created with the 'start with data' feature of Power Apps. No changes have been made to this app. When we run the app and attempt to save a record, we receive the following error.



The error indicates that a specified column is read-only and can't be modified. How do we identify the name of the column that causes this error?

The answer is to use the Monitor tool. From the Power Apps designer, we open Monitor through the Advanced tools section in the left-hand panel.

 

Once the Monitor is open, we can run our app in the designer and recreate the bug. We then review the trace (as shown beneath). Here, we see the name of the column that causes the error - cre23_isimportant in this example. Note that the errors are conveniently highlighted with a red exclamation mark, therefore making them easy to find.



We can now fix our app by removing making this field non-editable in the form designer.

This is just one example of something that causes the "Network error when using Patch function" when calling SubmitForm. Other common causes I see include:

  • Submitting a form that attempts to create duplicate values in a column that's configured to accept unique values only
  • Submitting a form that includes a card that links to a calculated column
  • Submitting a form that violates some other server-side validation rule

Conclusion

If we receive the error "Network error when using Patch function", the first thing to do to diagnose the cause is to run the Monitor tool. In almost all cases, reviewing the trace will reveal the cause of the error. 
Related posts