Navigate action in Power Apps App.OnStart is now deprecated
or a lot of Power Apps, I use a conditional Navigate() action within my App.OnStart to determine which screen the user should be redirected to when loading the app. But as of now, it is no longer supported to use a Navigate action within the OnStart of your Power App.
In this short blog, I will explain to you how to make sure you can still direct users to another screen when loading your app.
No worries
First of all, don’t worry that your Power Apps won’t work anymore as of now. This change only reflects the newest framework version of Power Apps.
I’m not sure which version exactly, but it seems like starting from version 3.211xx.xx, Navigate is no longer supported within the App.OnStart. You can check the current framework version of your Power Apps in the version history of your app:
Version in which Navigate is supported within App.OnStart
Version in which Navigate is not supported within App.OnStart
So your old apps will continue to work, but it does mean that when you start making changes from now on, you will automatically be on the newer framework version and that it is no longer supported.
Redirect users when loading apps
There are two ways to make sure your users will still be redirected to another screen when loading the Power App:
- Re-enable Navigate within App.OnStart (temporarily)
- Use App.StartScreen instead of App.OnStart
I will explain both methods below.
Re-enable Navigate within App.OnStart
This is the quickest method, but also a temporary one because Microsoft ultimately wants you to use the method as described below. It basically comes down to re-enabling the Navigate() action within your OnStart. For existing apps, this feature will automatically be enabled.
For new apps, you can enable this by going to File > Settings > Upcoming features > Retired and enable the ‘Enable the Navigate function in App.Onstart‘ feature:
This allows you to keep using the Navigate() action within your OnStart for the time being. But eventually, this feature will be retired and you need to use the method as described below.
You will also be prompted with a warning that it is not recommended to use the OnStart for this behaviour:
Use App.StartScreen instead of OnStart
To make sure your apps will keep working for a longer period of time, you need to configure your App.StartScreen to set the start screen of your app.
This can be done in a static way or dynamically using a condition:
This also means you don’t need to have the start screen as the first screen in your tree view. You can just set the screen of your choice as start screen, whether that is the first, second or even the last screen in your tree view.
Please make sure to choose either a static or dynamic formula, otherwise it won’t work.