Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Network Error When Using Patch Function: permissions issue?

(0) ShareShare
ReportReport
Posted on by 667

I have been getting the Network error When using Patch Function: operation is not valid, when trying to upload a single record to an Azure SQL database table.  I do not get any errors in the OnSelect code until I try to run the patch with a button.

 

I am definitely connected to the database table and can read data from it, and I have supposedly been granted write access based on the credentials I was provided to this cloud-based Azure SQL database.

 

The OnSelect Code is below.  Could this error be caused by not actually having write permissions, or would that error message be more sp;ecific?

 

I was careful to match the data types being pushed from PowerApps to the data type in the SQL table. In fact, I received initial errors about mis-matched data types, then corrected the data that I was trying to submit. Mostly hard-coding in the data answers for now to test the connection.

 

Thanks. Any ideas would be appreciated.

 

Runner55552_0-1671230176145.png

 

  • cha_cha Profile Picture
    4,909 Super User 2025 Season 1 on at
    Re: Network Error When Using Patch Function: permissions issue?

    Hello @Runner55552 

     

    Glad that you got it working. Had a busy day yesterday so couldn't get back to my computer.

  • 55552 Profile Picture
    667 on at
    Re: Network Error When Using Patch Function: permissions issue?

    Update:

     

    Found a more detailed error message, so I will need the database manager to make some edits to the data tables, regarding foreign keys.

    "error": {
          "message""The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_PalletLoad_Pallet\". The conflict occurred in database \"QCastService\", table \"dbo.Pallet\", column 'ID'."
    Also, I was able to get the SharePoint Patch function working with text input boxes. I needed to add .text to the end of the input name, and also needed to add value in front of the numeric input.
     
    Runner55552_0-1671320552917.png

     

     
     

     

     

  • 55552 Profile Picture
    667 on at
    Re: Network Error When Using Patch Function: permissions issue?

    I did more testing with a SharePoint list where I have read/write access.  I was able to push hard coded text and numbers to the list, but as soon as I tried to use a text input box name to push the data, I received the network error again. Do input boxes, choice fields, etc., need to be inside a gallery (connected to the data source) to allow pushing to a data source?  Here is my simple Patch Code referencing some simple input boxes. One holds numbers (formatted as Number) and one holds text.

     

    Runner55552_0-1671297944358.png

     

  • 55552 Profile Picture
    667 on at
    Re: Network Error When Using Patch Function: permissions issue?

    Thanks for the reply. CreatedOn and ModifiedOn may not be auto-created, although I will ask the database owner to make them auto if not. But, for some reason, they are required fields. If I remove them from the Patch code, I get an error stating that they are required.

     

    Regarding the Submit Form option. I am pulling a list of IDs from one data source, then submitting the IDs that I select to a different table/data source.  The Submit Form and form seems to work primarily with a single data source. Maybe I need to have the ID selection outside the form, then the pull in that selected ID inside the form (Selected.ID), then try Submit.

  • 55552 Profile Picture
    667 on at
    Re: Network Error When Using Patch Function: permissions issue?

    Thanks so much for your reply. I tried deleting the SQL data source, then reconnecting it, same error.  Here is a screenshot of the log with errors. Bad Request may be a permissions error. I am not the database owner. The provided credentials were supposed to be read/write, but I am suspecting those credentials may only have read access.

    Runner55552_0-1671290082436.png

     

  • Verified answer
    cha_cha Profile Picture
    4,909 Super User 2025 Season 1 on at
    Re: Network Error When Using Patch Function: permissions issue?

    Hello @Runner55552 

     

    If it was a permission issue, the error would directly point it out. Also, Patch will prompt that you don't have write access.

     

    Your code looks good. I'm suspecting it's just a matter of clearing the cache and re-adding the connection. Since you've made changes to the database, sometimes changes don't reflect immediately with the current connection in Power Apps without removing/adding again similar connector details.

     

    Lastly, do this if the above is not helping.

     

    Use Monitor to catch more detailed info about errors. It helps in showing the exact error that SQL is telling PowerApps.  There might be more to that message. Please share it here for follow-up investigation.

     

    To do this, go to App Checker > Open Monitor

    cha_cha_0-1671238598594.png

     

    It will launch a screen that will log what you are doing. Below is an example of what the log looks like but is not directly relevant to your case.

    cha_cha_1-1671247152984.png

     


      ✔️
    Just in case my response helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

     

      🔗
    🕸bistek.space  🐦 @cha_bistek  📺 @BisTekSpace 
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Re: Network Error When Using Patch Function: permissions issue?

    @Runner55552 

    Have you tried using an edit form and simply using SubmitForm(Form1) to see if it works.  If your database automatically inserts metadata for CreatedOn and ModifiedOn, eliminating these two values from the patch may make it work.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard