cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Only show ConfirmExit per screen

Happy Saturday!

What is the best approach to have the ConfirmExit work per screen? Is it possible ?

 

Example 

Screen1 Is the form where users enter information also where the ConfirmExit show prompt them

Screen2  Where ConfirmExit doesn't prompt them.

 

Capture.PNG

 

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Only show ConfirmExit per screen

@oappdev 

I think the simplest approach would be to put this code in the OnVisible property of each screen

Set(currentScreen, "Screen1")
Set(currentScreen, "Screen2")

 

Then use this code in the ConfirmExit property of the app to conditionally show the prompt based on the current screen.

Switch(
    currentScreen,
    "Screen1", true,
    "Screen2", false
)

 

The SWITCH function above can be modified to accommodate as many screens as you need. 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Re: Only show ConfirmExit per screen

@oappdev 

I think the simplest approach would be to put this code in the OnVisible property of each screen

Set(currentScreen, "Screen1")
Set(currentScreen, "Screen2")

 

Then use this code in the ConfirmExit property of the app to conditionally show the prompt based on the current screen.

Switch(
    currentScreen,
    "Screen1", true,
    "Screen2", false
)

 

The SWITCH function above can be modified to accommodate as many screens as you need. 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Post Patron
Post Patron

Re: Only show ConfirmExit per screen

As always, thank you @mdevaney 👍

Highlighted
Super User III
Super User III

Re: Only show ConfirmExit per screen

@oappdev
Anytime! Did this solve your problem? Let me know if you need anything else.
Highlighted
Post Patron
Post Patron

Re: Only show ConfirmExit per screen

That did the trick @mdevaney 😎 Going to push it to production on Monday

Highlighted
Advocate I
Advocate I

Re: Only show ConfirmExit per screen

@mdevaney  solution can be improved by using App.ActiveScreen.Name


It SHOULD be possible to use that directly in the ConfirmExit formula (App.ActiveScreen.Name = "Screen1"), but annoyingly it gives the error:

"The control reference cannot be used in this property"


However, it can still be helpful to use to dynamically populate the variable, so you can create the formula once and copy/paste it to every OnVisible screen, and it will automatically update if you change a screen's name.

 

ConfirmExit is the same as yours, but in OnVisible for each screen use:

Set(currentScreen, App.ActiveScreen.Name)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,366)