cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jchopp
Helper I
Helper I

Refresh after the submit button

I have a display and edit screen.  The movement between the two work real well.  However, if I display a list entry, then edit it and click on submit, it will go back to the display screen with the list entry I just edited (which I want), but then it refreshes within a second and go to the list entry that is listed first in the sharepoint list.

Is there a way to keep it on the list entry that I just edited?

 

Thanks,

18 REPLIES 18
PaulD1
Community Champion
Community Champion

You might want to try avoiding the reference to Gallery1.Selected and instead having the Gallery1 OnSelect property set a variable and using that variable in the Item property for the forms.

If something is causing Gallery1 to refresh, a different (usually first) record becomes the currently selected item (but should not trigger the OnSelect) which causes your forms to change the record they are displaying in the current configuration.

@CNT 

I tried changing the button OnSelect attribute to point back to the EditScreen, but it still goes to the DisplayScreen.  This is what I have for the OnSelect:

SubmitForm(EditForm);If(EditForm.ErrorKind=ErrorKind.None,Navigate(EditScreen,ScreenTransition.Fade))

@PaulD1 

Ok I think I have the var set on the OnSelect of the gallery:

Navigate(DetailScreen, ScreenTransition.None);Set(variableID,Gallery1.Selected.ID)

So how would I set the item property on the forms from here?

@Jchopp if u'r gallery and the view form are in the same screen you won't need the Navigate. Try removing that. 

@PaulD1 @CNT 

Just to see what it would do, I changed the OnSelect of the submit button on the EditScreen to navigate back to the ListScreen

SubmitForm(EditForm);If(EditForm.ErrorKind=ErrorKind.None,Navigate(ListScreen,ScreenTransition.Fade))

I then ran the screen and checked it out.  When I hit submit, it went to the ListScreen, then a second later went to the DisplayScreen (showing the first entry on the list).  Just a little more info.

@CNT 

I was looking around and found that I had a OnSuccess statement in there:

Navigate(DetailScreen,ScreenTransition.Fade)

After removing it, I was able to get the EditScreen to stay up.  So, would I be able to use a var with the OnSuccess screen to keep the current display screen on the ID I just edited?  If so, how would I right that?

@Jchopp In your case I believe its better not to use a variable in the OnSelect of the Gallery. It would be better to comment out Set(variableID,Gallery1.Selected.ID) and set the items property for both the Display and Edit Forms to gallery1.selected.  This will keep a clear link between the gallery and your forms and avoid jumping around.

@CNT I have put everything back like you suggested, and just pointed the "Save" button to go to the ListScreen (Main screen for the app) and everything works that way.  Unless you have something else for me to try with the display, I will just leave it like that right now.

@Jchopp I would suggest to leave it. Glad o help!

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,704)