Wednesday, March 20, 2019

A simple solution to implementing proper back functionality in PowerApps



When navigating between screens in PowerApps you use the Navigate function. There is also a Back function which takes you to the previous screen. The caveat with Back is that it doesn’t build a navigation history, but remember the previous screen only. This means that if you go from screen 5 to 4 using Back, then the next Back call will take you to 5 again, not screen 3.

Do I really need to think about this?
Well, if you have linear navigation in your application, you simply hard code navigation back and forth – no problem. If you have no-linear navigation, meaning you evaluate logic as to which screen will be the next, then this is for you.

Tell me the solution!

If you are on a screen named Screen1 you would typically navigate to Screen2 with:

Navigate(Screen2,Fade)

The clue is to add a third context parameter passing in the current screen which will be local to the new screen:

Navigate(Screen2,Fade,{LastScreen:Screen1})

Then on the back button of any screen use:

Navigate(LastScreen,Fade)



It’s all in the documentation if you care to read it :) https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

Photo by Chris MarquardtLicense

No comments:

Post a Comment