When building PowerApps one extremely useful feature available to developers is the URL parameters feature that allows parameters to be passed into the application on load from the URL.
In this article we will look at using such a parameter to load a specific screen when the application loads.
Why would you need something like this?
Let’s imagine you have created a really cool app with lots of screen and features but you also want to be able to direct people to specific parts of the app instantly, so let’s say I have a button on a page somewhere that says “Policies” and I want any users clicking on that button to be directed straight to the screen “Policies” within my PowerApp.
So a few steps will happen here:
- User clicks on the button
- Browser screen opens up PowerApp
- Applications loads and instantly takes the user to the “Policies” screen
- The user is happy as they have found the content they wanted!
So how do we set this up?
It is actually very straight forward to set this up, just follow the steps below:
1) Open the PowerApp in question in Edit mode
2) Click on “App” from the navigation menu on the left of the screen
3) Select the function “OnStart” form the dropdown menu on the left
4) Enter the following into the load box:
This will be used to make sure the user doesn’t get redirect everytime they visit the homepage whilst still in the app
5) Click on “Insert” tab and then click on “Controls”
6) Click on the “Timer” object to add it to your project
7) Click on the newly created timer and select the function “OnTimerStart” and enter the following into the value box:
If(Param("screenID")="meaningfulName", Navigate('SCREEN NAME', ScreenTransition.Fade));
"meaningfulName" with an identifier that will be used in the URL to pass the parameter to the app
'SCREEN NAME' with the name of the screen you want the user to be redirected to on load
That’s it from within PowerApps! You can now save and publish the App.
Now simply add
meaningfulName with the name you choose to use in the previous steps) to the end of the URL used to open your PowerApp.
The App will auto load whicher screen you set “
meaningfulName” to load