Today I had a look at exiting a Powerapp. I create the My Exit App. This app has just a single button.
The button in the app calls the Exit Function to exit the app. When you run this app you will see some different behaviours depending on how you are running the app.
Exit in Design Run Mode
In design mode when you press F5 to test your app, you will find that nothing happens.
Exit in Run Mode
When you run the app within PowerApps you end up back home
Exit on your mobile
On you mobile device you also go back to your list of apps on the PowerApps home screen.
Exit from a SharePoint WebPart
If you add the PowerApp as a web part on a page in SharePoint.
The exit button will make the app appear empty, ready for the user to navigate in SharePoint.
Exit from the Appid Web link
The url that can be found on the Details screen for the app will open the app as it was opened from Dynamics 365. No surprise here that you will go back to the Dynamics 365 home page.
Are you sure?
With all of the above options the exit button will leave the app immediately without asking you if you really want to leave the app. There is however an option on the app that you can set to protect the user from losing unsaved data.
The Confirm exit message and Confirm exit will protect your app.
Within the confirm exit message you can set a message that you want to appear when the user closes the app.
If you configure these settings as shown above the click of the exit button will warn the user:
My thoughts
To implement this exit protection you could have created a separate screen asking the same question. This “Are you sure”-screen would then be called before any Exit function that is called. It might more feel like the same experience as the rest of your app.
I also noticed that when you close a tab in your browser the app still closes without any warning. Hopefully this is something that can be avoided too.
Peter, do you know if there is a way for a PowerApp to determine its runtime environment? If my app is running in a SharePoint webpart, I want to hide all options to “Exit.”
Hi Don,
You could pass in a parameter when you run the app from a SharePoint page when you run it from an SharePoint page. Then within your app read this parameter so that you can hide the option to exit
That is what I ended up doing! Works great! Thanks!