Showing results for 
Search instead for 
Did you mean: 
Advocate V
Advocate V

Back() function not working properly please help

Back() function not working properly:

I have 1 screen and that screen have one button of to create new record which redirects to another screen.


On that another screen I have written patch function to create record and after that I have written Back function.


It was working fine till this morning but at now I am facing this issue:

on first screen I have 3 records, I am opening third one then from that screen I am selected new record button which redirects to new screen, I am filling all information and creating record using patch function. After this code I have written "Back(ScreenTransition.Fade)".

It should navigate me to the screen and should display me third records detail, but it is displaying me by default always "first record" details.


I have tried to create new screen and write all the things again but it does not working.


Please help.

Impactful Individual
Impactful Individual



you can use navigate too

I have tried it, its not working properly.


It navigates back but displaying wrong information - It is displaying first record's details on screen instead of displaying selected record's details by default.

Responsive Resident
Responsive Resident

This is probably to do with the Default of your gallery and not with the Back() function. If you change something in the datasource used in the Gallery, it will select the default item again.


the screen which is not displaying proper information is having "Edit Form" and its "Item" property is set to "BrowseGallery_1.Selected". So it should display the selected record fields on that edit form.


It is displaying for 1 to 3 seconds correct information and after that 1 to 3 seconds it is changing information and displaying first records details on that Edit form. That information is auto refreshing.


As @Sofie_D suggested, your issue is more likely with the Gallery default and that it is getting changed, thus causing the EditForm Item property to use the newly selected default value, which is record 1.

What is your Default property on your Gallery like?  Also, the Items property on the you have anything going on in there that might cause the issue.


To make a quick resolve (which will not resolve the default selected item in the Gallery), you can use a variable instead of the Selected item.

On the OnSelect action of your Gallery, put this formula -  Set(currentItem, ThisItem)

Then, change the Item on your Form to currentItem


Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Community Support
Community Support

HI @rajmilansinh ,

Do you list your data source records within a Gallery?


Based on the issue that you mentioned, I agree with @Sofie_D 's thought almost. When you use Patch function to add new item into your data source, your data source would be refreshed, so your Gallery would be refreshed/reset.


As an alternative solution, you could consider take a try to save the selected item in your Gallery into a variable, then use that variable within your Edit form.

I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the Gallery to following:

Set(CurrentSelectedItem, ThisItem)

Set the Item property of your Edit form to following:


Please take a try with above solution, then check if the issue is solved.


Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-xida-msft, I have implemented this way and its working fine but I have another issue which still remains same.

And that is connected with this issue.

So I provide details here:

First screen having 3 records.

I open third one.

Second screen shows selected record's edit screen.

On second screen I am having 1 button for creating new lookup record for the current entity.

By that button I am navigating to Third Screen which is having fields of another entity's to be filled.

When I fill all information on third screen and submit the form, what I expect when I go to second screen - there is one lookup field which should display the newly created record's name which was I just created from the third screen.

So by default it was not showing newly created record there, so I had written Refresh('DataSet') function so that I can get newly created record on that lookup field.

It was working fine till I had no issue with the back function.

I faced the issue which I have mentioned on the post.

Then I tried your solution, It was sucess to get the selected record details on the second screen but now I am failing to get newly created record on that lookup field on second screen even there is already Refresh('DataSet') function written.

I also tried to remove that refresh function and test the application but though I have same issue.


Hope you can understand the all details.

Let me know if you want more details here.

Helpful resources

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

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.

Users online (4,150)