Sometimes, when you select an entry in a Gallery which takes you to another screen with Form and Gallery controls where Item is set to Gallery.Selected, PowerApps will display the wrong record in the related controls. The issue is related to the timing of the click/tap in the Gallery (has the screen fully refreshed).
I have an OrderHeaders table and OrderDetails table in SQL Azure DB.
In my PowerApp I have a screen with gallery galOrderHeader.
I have another screen with a form frmOrderHeader that shows the details of the OrderHeader selected in galOrderHeader. This screen also has a Gallery galOrderDetail showing the OrderDetails related to the OrderHeader selected in galOrderHeader.
A 'Next' button in galOrderHeader takes the user to the screen with frmOrderHeader and galOrderDetail.
Observed Behavior (App contains two OrderHeader records, Bob and Jane:
1. Click entry 'Jane' in galOrderHeader to open the screen with frmOrderDetail and galOrderDetail. Correct data is displayed.
2. Click 'go back' to return to the first screen.
3. Wait for the screen to fully refresh.
4. Click entry Bob in galOrderHeader to open the screen with frmOrderHeader and galOrderDetail. Correct data is displayed.
5. Click 'go back' to return to the first screen.
Now perform the above steps again, but do not wait for the first screen (with galOrderHeader) to fully refresh in step 3. You will still be able to click the button to take you to the next screen - initially, you will see the record for Bob but after a second or two it will change to show Jane again. I have even seen the frmOrderHeader show the details for one record but galOrderDetail show details for another.
This behavior is the same in the editor, web player and on mobile.
The correct record should always be shown in the related controls, even if that means preventing a user from making a selection until the Gallery has finished refreshing.
Screen recording demonstrating the bug: https://1drv.ms/v/s!Ag1ZVAvAeJJnt70lD6q7PyOzXN09HA
Solved! Go to Solution.
I've got this logged with support as a demonstrated bug in web/win/ios/droid apps. Enhanced rendering off doesn't fix it. Nor does "Explicit Column Selection" in advanced app settings. The problem is not present in 'simple' gallery item lists; it occurs for me with a complex filtered list (and engineering task list filtered by engineer name and required date). if i switch off the filtering code, item selection works. If it switch on then the first time an item is selected after opening the app, the wrong item (in fact the first on the list) is selected. Return to screen 1, select again and it's OK. more details here: Bug with complex filtering of gallery
Did you ever figure a robust solution for this? I am struggling with the same issue on my app which contains two galleries presenting the same SP list (one of the gallery is filtered). I believe the opened form is stuck on the previous item opened from the unfiltered gallery when opening from the filtered gallery.
EDIT: I got it to work using the variable on screen navigation 🙂
I didn't need to fix in the end as Microsoft fixed the bug in the product to stop it. We mixed up educating users to do the work around, and simplifying a second version of the app to avoid it
I fixed it in my app by defining a variable every time you click on the gallery item (naming the variable something like "CurrentItem"), and then refering to "CurrentItem" later in the app, instead of the default ThisItem.
yes - in that the bug in the gallery was identified and fixed by Microsoft in a later release of PowerApps (just a few weeks after my post)
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.