cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helen_BB
Helper III
Helper III

Power apps Patching to a SharePoint list is overriding other records.

Hello,  we have been using this app for about a year now and just after Christmas started seeing a bug in the App. 

 

The user will go in and see a gallery with their teams records in the user will go into each record and update info and save this info using Patch to a share Point list record. 

 

for some users when they have saved their record and then moved into another record from the gallery the power apps is saving the original record but then also saving over the new record that they have clicked into. 

 

i have added some features into the app so that they can't navigate away from a page whilst saving but this hasn't solved the issue can anyone please help? 

 

here is my save code

 

Patch(PDP1,{ID:PDPID},{MidYr_x0020_Ambition:'MyAmbition'.SelectedText,EndYr:MYA.SelectedText,MidYr_x0020_NextRole:NxtRole.Text});Refresh(PDP1); Refresh('PDP1 Objectives')

4 REPLIES 4
poweractivate
Super User
Super User

@Helen_BB 

 

To help with this issue of things saving over other things intermittently, try having the Patch reference the selected Gallery item directly instead of using bridge variables or bridge collections if possible.

 

When using those bridge approach it can introduce unpredictability and cause this kind of issue.

Hi Thank you for this suggestion, previously my code was ..

 

Patch(PDP,{ID:Gallery1.Selected.ID},{MidYr_x0020_Ambition:'My Ambition'.SelectedText,EndYr:MYA.SelectedText,MidYr_x0020_NextRole:NxtRole.Text});Refresh(PDP); Refresh('PDP Objectives')

 

and this is when my issue started happening so i swapped over to using a variable yesterday to see if this helped my issue but the problem is occurring in both scenarios.

 

Do you have any other suggestions? 

@Helen_BB 

 

If instead of single button, you instead put the button on each Gallery item and in Patch statement make sure to always reference the fields from inside the Gallery (they would always have the same control name of course) and also make sure to reference ThisItem instead of Gallery.Selected, does the issue still happen?

 

You can then try moving it outside the Gallery after that but if you put the button inside the gallery (so there would be one button per record instead of just one button) and rewrite the patch to use ThisItem an make sure it uses the controls in the Gallery, does the issue still occur even so?

 

 

Thanks for this 🙂

 

its a bit tricky as there are multiple pages once you click into an item from the Gallery but i can do some testing and see what happens. 

 

thank you 🙂

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,620)