cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MAV_CB
Microsoft
Microsoft

SubmitForm command changes Gallery.Selected item record

I have an app connected to a SharePoint list. I have a form that is in Edit Mode, and loading from a Gallery via .Selected property. After submitting changes successfully, the Edit Form control is changing the .Selected value to the first record in the data source set. This should not be happening, it should just load the currently selected record. I noticed this change today and last worked on the app late last week. Anyone know why this would happen? I haven't changed anything in the code since last week :(.

 

Thanks!

40 REPLIES 40
Anonymous
Not applicable

This is an excellent solution, thank you! Hopefully the product team will address this at some point. 

edbellman
Advocate II
Advocate II

For what it's worth, this is still an issue in early 2020, almost 4 years later.

 

I have a filtered gallery and when using Patch on a form, if using Gallery.Selected the form or fields in question will patch correctly but then the data refreshes or reloads the first record in the gallery, not the selected record.

 

The work-around of setting gallery.selected to a global variable and then referencing that everywhere (Item property and Patch function) works but was a pain to research and resolve.

LilySnow
Frequent Visitor

2021. 5 years since the original post. Same problem here. Well done PowerApps team!

It's not actually a problem, which is why it's not been 'fixed'.

 

You shouldn't use gallery.selected to keep track of an item you're changing. If you want the same effect, you should store the ID of the item you are editing in a variable, and do a lookup for the item matching that ID instead of using gallery.selected, which is intentionally transient.

Thanks for the replay @davidstone 

 

I have a gallery and a form and actually use a variable instead of Gallery.Selected to look up the item. But once the form is submitted, the gallery jumps to the first row.

Ah yes, there's sadly no control over the scroll position of a gallery, which can be a real pain. Additionally, if you update a record on which the gallery is based, then the gallery has to reload to get your new changes, and thus the current scroll position is lost. ☹️

jwp132
Regular Visitor

This problem is still an issue. 

IT IS STILL NOT FIXED 5 YEARS LATER!

@JoshHoughton  - thanks for the suggestion. It's not working for me

Scenario: I have a sharepoint list based powerapp where on selection of gallery item the edit form page display the selected record. With Gallery.selected it's working perfectly fine. however, when I reach to the item # where I do not have data for the columns display in form, on submission of form it throws back to 100th item of gallery. I tried with custom variable, however, it's not even displaying a record for my form. 

lbush
New Member

FYI - it's February of 2022 and I just found this and I am having the same issues.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,397)