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

Editing a existing gallery items creates a new entry

Hi,

 

I am having issues when editing an entry in a gallery. When I select the item in the gallery to edit it displays the data. When I change and submit the data it creates a new entry in my Sharepoint list instead of editing the one I selected from the gallery.

 

My submit button code is 

Patch('LATENT DEFECT TRACKER',
Defaults('LATENT DEFECT TRACKER'),
'Pending Latent Defect'.Updates,'Pending Latent Defect_1'.Updates);
Navigate(Success)

 

I have two forms I want the data to be updated with Pending Latent Defect and Pending Latent Defect_1

 

The code for the edit button in my gallery.

EditForm('Pending Latent Defect_1');
Navigate(
Screen2,
ScreenTransition.Cover,
{SelectedItem: Gallery3.Selected}
)

This seems to select the form I want to edit.

 

The properties for my gallery3 items = 'LATENT DEFECT TRACKER'

 

For some reason, it keeps on creating a new entry when I submit the form and not amending the original one.

 

Thanks in advanced 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Elliottd ,

You need to tell Patch which record to update (I have assumed you are using SharePoint here)

Patch(
   'LATENT DEFECT TRACKER',
   {ID: Gallery3.Selected.ID},
   'Pending Latent Defect'.Updates,
   'Pending Latent Defect_1'.Updates
);
Navigate(Success)

 

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.

Visit my blog Practical Power Apps

 

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @Elliottd ,

You need to tell Patch which record to update (I have assumed you are using SharePoint here)

Patch(
   'LATENT DEFECT TRACKER',
   {ID: Gallery3.Selected.ID},
   'Pending Latent Defect'.Updates,
   'Pending Latent Defect_1'.Updates
);
Navigate(Success)

 

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.

Visit my blog Practical Power Apps

 

Elliottd
Frequent Visitor

Fantastic adding the gallery3.selected.id has worked and it now modifies the original form and does not submit a new item in my SharePoint list. Thanks for your help. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,747)