Hello all!
I have a PowerApp where you can view records in a Gallery by selecting them, and in the next screen there is a tiny 'Edit' icon in the top-right that lets you modify details of that item you selected.
When you click on that Edit icon, it takes you to a screen that has an Edit Form. In that Edit Form screen, there is a 'checkmark' in the top-right that resubmits the form (using a Patch function). Here is the code behind the OnSelect of the submit button on the next screen:
When submitted, it updates that existing record (which is good), but also creates a new one. Why is it doing this even though I'm not using Defaults? Maybe because I didn't include 'Attachments' in the patch? How would I fix this?
Thank you so much!
J
Your solution was spot on, will be sure to reference the ID from selected gallery record in future patches, missed out on that small detail. Thanks again!
I actually forgot a comma lol ~ testing out your solution right now.
Hi @WarrenBelz
Thank you so much for the response, I will for sure be attaching the code in Text next time. So essentially, we have a gallery ('Gallery4') that displays records that are clickable that will take you to each record's view screen (as showed in my first screenshot of my previous message). Once you have that record's details open, I would like to include the option to edit that record, hence the 'edit icon' in the top right corner. Once that icon is clicked, it takes you to an Edit Form (I greyed out the rest of the fields and only want the user to be able to change the 'Followed Up?' field)...
... I then put your code into the 'check-mark icon' that submits the changes and ideally should patch updated info to that same existing record, not create a new one. This is the error that came up:
It makes sense we need to reference the existing record's ID to specify which item in our SP List to have those changes sent to, but it's not liking that ID reference we included in the code.
Hi @jharville ,
The thing I am wondering here is how it actually updates the existing record as you have not referenced it in the Patch. You do not need Defaults() to create a new record - it is inferred unless you specify an existing record to Patch (so the new record is not a surprise). I can see you have commented out the SubmitForm - this is all you really need to update the existing record - do you have any other code running here ? Also if you selected the record from a Gallery, you can do this
Patch(
'Operator Connect Log'
{ID: GalleryName.Selected.ID},
{
'Operator Name': DataCardValue5.Text,
'Restaurant Number': DataCardValue6.Text,
City: DataCardValue7.Text,
State: DataCardValue8.Text,
'Notes For Follow Up': DataCardValuelQ.Text,
'Followed Up?': Checkbox2.Value
}
)
Lastly, please post your code in Text - saves OCR or a lot of typing this end.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,957
Most Valuable Professional