What is a Navigator App?
I built a number of Power Apps that users often did not recal. Since they were also designed to run in a particular order, it was equally common that users might also skip one or more steps.
I created tabs in Teams to not only specify the apps but also showed the order. That left something to be desired:
- Too many tabs so that they all didn’t show at once
- Not much in the way of reminding them the run orer.
My Navigator Solution
Great, I thought, I will just create a Power App that lets users run apps by clicking on buttons but will show the order they should be run. Sounded pretty straightforward.
But then a few isses developed.
How do I get the app to run another app but return to the navigator app when exiting the referenced app? Turns out the solution was a series of things.
Steps to solve the issues
The place to start is the OnSelect propery of each button to run another app. The Power App function to use is Launch(). I used Launch() with three parameters:
- The link to the target app;
- The parameter to ue;
- The destination tab/windown control
The link parameter could be one of tw forms: the https for the app or a specific app reference. Both of these can be found on the details page of the app as shown in this sample
I used the app ID and it was something like this:
Launch(“/providers/Microsoft.PowerApps/apps/<appID>”
Of course, substitue the actual app ID and make sure to use the exact string before it all in double qutes.
The next object in the expression is for parameters. I simply needed just a single paratemter that I could test in the app to determine if it had been lauched by the Navigator app or the user accessed it directly. I used the same parameter for all apps like this
{q: “Nav”}
Later I will ecplain why I pass a parameter and how to use it in the target apps.
The third and last value I set to LaunchTarget.Replace. This tells Navigator to use the same window to run the target app. The full expression is
Launch(“/providers/Microsoft.PowerApps/apps/20528f0f-c9fc-40e5-861a-<more…>”,{q: “Pick”}, LaunchTarget.Replace)
I then added a Exit(false) expreession.
Of Course This Didn’t Work Properly
I say of course but rest assured I thought it would. I wasn’t able to return to the Navgator app and see it reappear in the same browser tab.
After some testing, I came up with the following solution.
On a blank new sceen, I added a timer control. I set Duration to 3000 or 3 seconds. I set OnTimerEnd to Exit(false). I set Startto varTimer. Then I modified the OnSelect to be
Launch(“/providers/Microsoft.PowerApps/apps/20528f0f-c9fc-40e5-861a-<more…<“,{q: “Pick”}, LaunchTarget.Replace); Set(varTimer, true)
Modiying the Target Apps
Each target app required two changes:
- In the App->Onstasrt, insert Set(varParam, Param(“q”))
- In the app Exit or Quit button, insert
// If started from launcher, return to it else just exit
If(IsBlank(varParam),
Exit(),
Launch(“https://apps.powerapps.com/play/d16bb196-d5c5-4093-8bc8-9767408a4637?tenantId=b6904651<remainder…>”, {q:1}, LaunchTarget.Replace))
In other words, if no parameter were passed, the user executed the app directly, otherwise invokded by the Navigator. I used the url in this example but it could also have been the app ID format.
Works Great!
Now it all works as intended. Click on a button for a target app, the Navigator goes away and the target app appears in the same browser tab. Exit the app and the Navigator reappears in the same tab. Pretty fast aswell.
Except that….
Maybe yor recall Gilda Radner as Roseanne Roseannadanna on SNL. As she said, “It’s always something.” Imagine my surprise to hear from users that clicking on any of the app launch buttons did nothing at all. I tried debugging but it always seemed to work just fine. Then I found users having this problem were running Navigatorapp inside Teams since I had added that tab. And it’s true that nothing happens when it runs in Teams.
That seems to make sense.