How to dynamically show the start screen of an App in Power Apps Canvas apps?

Welcome to another blog on Power Apps. If you are in the blog, you must have worked with Canvas apps. And if you have worked on Canvas apps, you are aware that by default,  the first screen shown when an app starts is the first in the Tree View in Studio.

More often than not, we need to dynamically change the starting screen of the app based on custom business logic. But how we used to manage it?

We had the “OnStart” event of the app where we shall check for custom business logic and then use the Navigate function to move to the desired screen.

For example, the below code written in the app OnStart method navigates the user to Manager Screen if the user is having a direct reportee.

Starting screen of a Power App Canvas app based on custom logic

You may be wondering, isn’t it throwing an error. Yes it is. But this used to work till Microsoft decided to retire the use of Navigate in App OnStart.

And that is why you get the error. You can get rid of the error by enabling the retired feature from the app settings.

Starting screen of a Power App Canvas app based on custom logic

But Microsoft have already put it in retired stage. Enabling this feature from the retired features is obviously not the suggested approach.

Then what other option do we have? Well, Microsoft is not going to disappoint you. Microsoft have introduced a new property ‘StartScreen‘ where you can explicitly set the starting screen of the app. The same code which was not working earlier, can be written in StartScreen property to make it work successfully.

Starting screen of a Power App Canvas app based on custom logic

This is indeed a huge performance improvement as well. The StartScreen property shall work irrespective of the OnStart property of the app. Previously when we used to use Navigate function inside Power Apps, the app would be wait to show the screen till all the logic in the code was executed successfully.

With the introduction of StartScreen event, you can still continue to perform data load tasks inside your OnStart while the screen navigation logic, you can write in StartScreen.

Hope this helped!

You will also like the below posts.

Debajit Dutta
Business Solutions MVP