Power Apps: Deprecation of Navigation Function in App’s OnStart

Introduction

One of the common ways to switch screens or set the start screen was to use the App.OnStart to specify the Navigate function that will show the specified screen on startup. In case we are passing a Query parameter via weblink that opens up the Power App, the Param function could have been used to get the query parameter value based on which we used to Navigate to that specific screen.

However, Navigate function is being deprecated in the OnStart of the App considering performance reasons and if we try to use the Navigate function in the Onstart, we will get the below error message. Here we are trying to get the Query String Parameter Value “View” using the Parm function and Navigate to the corresponding Screens.

“Navigate is not permitted in OnStart. Use the Start Screen property instead”
Graphical user interface

Description automatically generated

Workaround

In case you have too many apps which were created before March 2021 and you need more time to make the changes by switching over to the Start Screen Property which obviously involves end to end testing as well, one of the workarounds that may work for a while is to re-enable Navigate function.

Note: Re-enabling the Navigate is not a recommended approach as it is deprecated and will put your application at further risk.

We can re-enable the Navigation within the OnStart property by heading over to File->Setting->Upcoming Features->Retired

Here, toggle the Off button in Enable Navigate function in App.OnStart to On

Graphical user interface, text, application

Description automatically generated

Now the Navigate function will still work and we can test it by hitting the Power App link that contains a Query Parameter named View with value as Admin.

https://apps.powerapps.com/play/4002208c-8de3-41a4-b29b-774d69378fb8?tenantId=b3629ed1-3361-4ec4-a2b7-5066a5c5?View=Admin

It will Navigate to the Admin screen of the app as we have added the Parm Function to get the View Query parameter and Navigate to corresponding screens in the OnStart Property.

Graphical user interface, diagram

Description automatically generated

Same way If we use the URL with Query parameter nurse, it will Navigate to the Nurse View of the App. Thus, for now, this workaround will work but the advised way to move forward is to use the Start Screen Property

Use the StartScreen Property

The best practice and the way forward is to use the StartScreen Property and not enable navigation in the App.OnStart. The same formula that we used in the OnStart can be changed to suit the StartScreen property as

If(Param(“View”)= “Admin”,Screen_AdminView,Screen_NurseView)

Here the expression checks the query parameter named View and if its value is Admin, it sets the Admin Screen as start screen else it sets the Nurse Screen as start screen.

Graphical user interface

Description automatically generated

Let’s test with the Nurse Query parameter link and we can see that the StartScreen Property has set the Nurse screen as the start screen

https://apps.powerapps.com/play/4002208c-8de3-41a4-b29b-774d69378fb8?tenantId=b3629ed1-3361-4ec4-a2b7-5066a5c5fa?View=Nurse

Graphical user interface, website

Description automatically generated

Summary

Thus we saw how to temporarily enable Navigate function in the App.OnStart and how to use the StartScreen Property to implement the workaround for Navigate functionality when the App starts up.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles