cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ConRobMcC
Frequent Visitor

EditForm new values not being reflected in the data source

Hi all,

 

I've been working on creating a PowerApp connected through a SQL Server database. The only thing causing me grief at the moment is the Edit/Submit Form. For some reason whenever I try and update a record in the edit form, and click my button that submits the form, the new data values aren't being pushed to the datasource. The new values stay reflected on the form itself, but the datasource isn't getting the new values. I have messages checking both the OnSuccess and OnFailure actions, but the OnFailure never triggers so I can't be certain what's going wrong here.

 

Does anyone have any ideas as to what could be the problem? I've tried searching the forums and google, but couldn't come up with anything that helped me fix the issue.

2 ACCEPTED SOLUTIONS

Accepted Solutions

@ConRobMcC 

I'm not sure where you are with respect to my suggestions.  Have you tried to let PowerApps create the app for you from the make.powerapps.com page using your SQL table as the datasource? 

View solution in original post

@Drrickryp 

 

Yeah I think the issue stemmed from trying to still use and manipulate an edit form generated from the read only table. Making a new app prompted me to go back and just try creating a different edit form which generated just fine and allowed me to write with no issues. Thank you for your help!

View solution in original post

20 REPLIES 20
Drrickryp
Super User
Super User

Hi @ConRobMcC 

This may be an obvious question but what is the OnSelect command of your Submit button and what is the Item property of your form?

Hi @Drrickryp 

 

The OnSelect is just a simple SubmitForm(formname), and the Item is the Gallery.Selected from the previous screen.

Hi @ConRobMcC 

Try Lookup(YourDataSource, ID=GalleryX.Selected.ID) and make sure the datasource matches the one listed in the Data Source property of your form and the Gallery name reflects the gallery in which the item has been chosen.  If that doesn't work, I suspect that the problem is going to be with the ID field.  Try removing it and re-selecting it again from the field list. 

@Drrickryp ,

 

Sadly that didn't help save to the datasource. As an aside, is that a better way of populating the Item field in the future instead of the basic Gallery.Selected?

@ConRobMcC 

I always use a lookup function as it will always work to identify the correct record in the original datasource.  The problem is if the datasource of the gallery is a collection or if it has been reshaped using AddColumns(), DropColumns(), RenameColumns() or ShowColumns(). ( ref. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping ) then it is no longer the same as the datasource in the form and a simple Gallery1.Selected will not work.  Form datasources must be actual tables and not collections or shaped tables. 

If the changes that you made to the edit form still do not work. To troubleshoot where the problem is, delete the form and try again with a new form.  Make sure that the ID field and all the other fields in the record populate when you select the record in your gallery.  Make sure that you have accounted for any field in your SQL table that is required by it. 

@Drrickryp 

 

Hmm, well I'm not sure what to say because the table I'm using is straight from our SQL Server and I haven't made any changes to the table on the PowerApps end of things. 

@Drrickryp 

 

When I try making a new edit form, all the data fields default to the view display mode (instead of edit) and each field has two text labels, rather than one label showing field name and a text input box for input. This is what happened when I first made the app and I just changed things to fit my needs, but I'm wondering if this hints at a deeper issue with the data connection itself?

Hi @ConRobMcC 

Make sure the form mode is set to Edit.  That there is a valid datasource and that the Items property of the form specifes the record being edited.  If all of these are done right, the form should show data in all of the fields.  

You can let PowerApps create your gallery and forms automatically if you go to make.powerapps.com and select SQL from the start from data.  Powerapps will make the entire app from your SQL table.  You can check out the properties of all of the buttons and forms to make sure you are doing it right. 

@Drrickryp 

 

So my initial problem stemmed from the fact the database table was being seen as read only from PowerApps's end, but after fixing the primary key column that issue is no longer the case. However, the SubmitForm function is still not properly updating the selected record. I've also tried using Patch() and UpdateIf(), but both of these functions throw the same error: that the "Specified record cannot be found. Server response: resource not found." 

 

Do you have any ideas as to what could be the issue? I've been looking at other forum posts that have a similar issue, but none of the responses have seemed to help me.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,083)