Most common scenarios are where you need users to be able to Exit the Canvas Power Apps in the below ways –
Scenario – Let’s say you put a close button somewhere in your App.
- Exit the current App but stay logged-in to Power Apps.
- Exist and Logout Power Apps entirely.
- In both above cases, ask user for confirmation before exiting.
So let’ look at these scenarios one by one –
Exit from current App
- Now, let’s say you’ve put a Close button on your App like this. And when you click it –
- It takes you to the App selection screen in your Power Apps
- You can implement this using Exit() method on OnSelect property of the Close button as shown below
And that’s it.
Exit and Logout of Power Apps
- Another variation to the same feature would be to Exit the App as well as Logging out completely. Now, I’ve put a Lock button here to represent Logout.
- You can implement this by using Exit(true) method as shown below
- And, it will logout the PowerApps Application itself.
And you’ll need to log in all over again.
Confirm before Exit
This is a feature that will work with both, Exit() and Exit(true). It will ask you for a confirmation on whether if you really like to close/logout the app?
- Select App in the left-hand Tree view, select App
- And look at the right hand Properties menu – The Confirm exit and Confirm exit message will let you enable this feature with the message you want to display –
And you can set your message
- And then, when you either Logout or try to Close the App, you’ll be prompted with this message
Note: For all the changes to take place in Canvas Power App, make sure all changes are Published and you force close and re-open the Power App (if using on a mobile device / Tablet). Wait for a few seconds to get notified about the latest version being available.
And it’s all that simple! In case you are looking for more articles on Canvas Power Apps, you might want to check these below –
- Variables in Canvas Power Apps | Global and Context
- Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
- Adding a Canvas PowerApp to Teams
- Correctly connect to an Excel file in a Canvas PowerApp
- Sending Image from Canvas PowerApps to SharePoint Document Library using Flows
Hope this helps!