cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
EdHansberry
Level 8

Unable to get SubmitForm to return to desired screen - EDIT vs NEW

I have a button in an EditForm that either adds or edits info. I had the OnSelect property for the button set as this:

 

If(EditForm1.Mode = FormMode.New,Navigate(MainScreen,Cover),Navigate(DetailsScreen1,ScreenTransition.Cover))

It always went back to the DetailScreen though, even if the FormMode was New, which should take it back to the main app screen.

 

So I found the OnSuccess property of the EditForm and changed it from Back() to:

If(EditForm1.Mode = FormMode.New,Navigate(MainScreen,Cover),Navigate(DetailsScreen1,ScreenTransition.Cover))

But it does the same thing. Adding or Editing a record returns it to the DetailScreen, never to the MainScreen.

 

What am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Unable to get SubmitForm to return to desired screen - EDIT vs NEW

Hi @EdHansberry,

In the button that sets the form mode before you navigate to the form's screen, and that holds the NewForm(EditForm1) command make the OnSelect property

NewForm(EditForm1); Set(screenback,1);Navigate(EditScreen,Cover) 

and in the button or icon that holds the EditForm(EditForm1) command, make the OnSelect property 

 EditForm(EditForm1); Set(screenback, 2); Navigate(EditScreen1,Cover)

In the OnSuccess property of EditForm1

If(screenback=1,Navigate(MainScreen,Cover),Navigate(DetailsScreen1,ScreenTransition.Cover))

These formalae should work independent of the form's mode.  The reason I avoided your approach is that I'm not certain what mode the form will be in once the OnSelect property runs and it most likely returns  to the default mode of the form which likely was Edit mode.  Thats probably why it didn't work for you.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Unable to get SubmitForm to return to desired screen - EDIT vs NEW

Hi @EdHansberry,

In the button that sets the form mode before you navigate to the form's screen, and that holds the NewForm(EditForm1) command make the OnSelect property

NewForm(EditForm1); Set(screenback,1);Navigate(EditScreen,Cover) 

and in the button or icon that holds the EditForm(EditForm1) command, make the OnSelect property 

 EditForm(EditForm1); Set(screenback, 2); Navigate(EditScreen1,Cover)

In the OnSuccess property of EditForm1

If(screenback=1,Navigate(MainScreen,Cover),Navigate(DetailsScreen1,ScreenTransition.Cover))

These formalae should work independent of the form's mode.  The reason I avoided your approach is that I'm not certain what mode the form will be in once the OnSelect property runs and it most likely returns  to the default mode of the form which likely was Edit mode.  Thats probably why it didn't work for you.

View solution in original post

EdHansberry
Level 8

Re: Unable to get SubmitForm to return to desired screen - EDIT vs NEW

THanks. This does work. I don't understand though why the SubmitForm() in OnSelect behaves differently than other fields in the form. For example, I have a field hidden when the EditForm is in NewMode via:

If(EditForm1.Mode=FormMode.Edit,Parent.DisplayName,"")

So it is tracking it. I guess the SubmitForm() is putting the form in a different state, or clearing the state?

 

Anyway, good tip. And I learned the Set() function to boot!

 

 

Super User
Super User

Re: Unable to get SubmitForm to return to desired screen - EDIT vs NEW

giphy.gif

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,843)