web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / POWER APP Patch statem...
Power Apps
Answered

POWER APP Patch statement runtime error

(0) ShareShare
ReportReport
Posted on by Microsoft Employee
Howdy all,
 

I am moving excel spreadsheet to SQL db with view and edit forms. I have created few screens and function buttons.

 

Add Forms are linked to the table via On Premise gateway and they are working as expected using PATCH statement. However after adding more forms, i am receiving back runtime error saying

"body": {
"status": 400,
"message": "A value must be provided for item.\r\nclientRequestId: d0045f72-b8e2-46f2-ad9e-eac1a4157796",
"error": {
 "message": "A value must be provided for item."
},
"source": "sql-uks.logic-ase-uksouth.p.azurewebsites.net"

}

My patch statement is not different from others that works:

Working one:

Patch(PreRequisites, Defaults(PreRequisites),
{
Named_Contact:DataCardValue1.Text,
Pre_requisites_CheckList:DataCardValue2.Text,
RFC_Number:DataCardValue3.Text,
Target_Date:DataCardValue4.SelectedDate,
Team_Responsible:DataCardValue5.Text
}
);
Notify("Record Added Your Grace",NotificationType.Success)

 

Runtime error one:

Patch(Testing, Defaults(Testing),
{
Date:DataCardValue17.SelectedDate,
Actual_Result:DataCardValue24.Text,
Activity:DataCardValue25.Text,
Description:DataCardValue26.Text,
Expected_Result:DataCardValue27,
Named_Contact:DataCardValue29.Text,
Notes:DataCardValue30.Text,
Owner:DataCardValue31.Text,
Pre_Req:DataCardValue32.Text,
Secondary_Resource:DataCardValue33.Text,
Status:DataCardValue34.Text,
Test_Outcome:DataCardValue35.Text,
Test_Resource:DataCardValue36.Text,
Time:DataCardValue37.Text
}
);
Notify("Record Added Your Grace",NotificationType.Success, 3)

 

 

I did checked if there is any required field and checked DB connection (added record on SQL server manager).

 

Currently i exhausted all resource i could find on net, and i am stuck with this. Could someone could help me with finding root cause of this issue? Also please let me know if more information is needed.

EDIT: I have noticed that there is one empty field returned from DB "@odata.etag"

"value": [
 {
 "@odata.etag": "",
 "ItemInternalId": "02eb0cf5-b83a-44f4-ba4a-6b3f9b70cfb9",
 "Date": "2021-12-22T00:00:00Z",
 "Time": "PT23H59M",
 "Status": "Due",
 "Activity": "test to test connection",
 "Owner": "mua",
 "Named_Contact": "mua",
 "RFC_Number": "RFCnot your bussiness",
 "Notes": "notes",
 "ID": 1
 }
]

Could you please advise if this can be removed, and if yes... how? 

 

 

Categories:
I have the same question (0)
  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    @Anonymous 

    Although you say that you checked the required fields, this almost certainly sounds as though there is a required field that you are not passing in your call to Patch.

     

    Another thing you can try is to refresh the connection to your 'testing' table from the data panel.

    Also, your testing table must have a primary key. If there is no primary key column defined, Power Apps will not be able to write data to the table.


    To diagnose this further, I would attempt to add a new record from your app using a form control rather calling patch. This will help you verify that your app can create records in the testing table.


    Finally, it is not possible to remove "@odata.etag" as this is a server generated value for conflict detection purposes.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     

    Thank you for response, I have tried submit form and it works only on first add form. To give you better understanding of my solution please see below screen structure:

     

    0s1cK_0-1640689507320.png

    I did checked all fields for screen, recreated it and confirmed if there is connection by adding record from backend (sql studio management) and checked if i can see it on power app. It was a pass. Also while creating tables i make sure that ID is a primary key in each table. 

    0s1cK_1-1640689636632.png

    Like above. Hope that helps a bit. 

     

    Scenario

    Use submit function to add record to sql table:

    Statement: 

    SubmitForm(Test_Form_1);
    Notify("Record Added Your Grace",NotificationType.Success, 3);
    Navigate(Test,ScreenTransition.UnCover)

     

    Surprisingly it worked 

    second row is new row.

    0s1cK_3-1640690297534.png

     

    Test 2:

    Changed other form from patch statement to submit form

    It WORKED!!! I have no clue where i was going wrong and why i used PATCH statement. 

     

    Is it possible to edit recently added records?

     

    I have edit button on each screen:

    0s1cK_4-1640690702065.png

     

    with simple statement with set function. However every time i am trying to edit it, it is adding new records. I do apologise if this is a daft question, however i am new in Power App, as you probably noticed 🙂

    Really appreciate help

     

  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @Anonymous 

    Yes, it's possible to edit the records. You would need to set the Item property of the form to reference the record that you want to edit. The "Record selection" section of the documention provides more details.

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail

    You would also need to swtich your form to EditMode by calling EditForm(Test_Form_1), before your call to Navigate.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, 

    Or I am daft, which is probably the case, or i can't set edit mode. What I did is:

     

    Added editform

    EditForm(Test_Form_1);Set(VarMode,"Edit");Navigate(Add_Test_1, ScreenTransition.Cover);

     

    And now form is not loading, 

    0s1cK_0-1640693696935.png

     

    form default mode is 

    0s1cK_1-1640693755214.png

     

    when set set varmode is removed. Effect is same. Nothing to display...

    Once Edit Form is removed varmode is not updating to edit but form is loading into NEW state. 

    It is annoying as Access 😄 

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard