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.
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.
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 Gallery...do 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
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 the Item property of your Edit form to following:
Please take a try with above solution, then check if the issue is solved.
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.
Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.
Fill out a quick form to claim your user group badge now!
Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities
Features releasing from October 2019 through March 2020
Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.
Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications