The Back function in Power Apps is used to
navigate back to the previous screen in your app. This is particularly useful
for creating user-friendly navigation.
PowerApps – Back() Syntax
-
Here,
Transition property is optional.
Note:
- Back() function takes you to the exactly previous screen (the latest screen
that you opened).
- Back() function will return False if you are on the starting screen
of the app and haven’t navigated to any other page since opening the app.
- You can
optionally use Navigate() function where you need to specify the screen where
you want to go.
- You can’t
set context variable in Back() function unlike Navigate() function.
Simple Back Navigation in canvas app
- You have 2
screens.
- Screen1
(Home screen) and Screen2.
- On Screen 2,
put a button and in OnSelect()
property of the button you can specify Back() function.
When the
user clicks this button, they will be taken back to Screen1.
Navigation in a Multi-Screen Canvas App using Back() function
Consider an
app with a more complex navigation structure, where users can navigate to
multiple screens from various points. Adding a consistent back button on each
screen improves user experience.
- Set up your screens:
- HomeScreen
- DetailsScreen
- SettingsScreen
- Add a Back Button to DetailsScreen and SettingsScreen:
- Insert a Button control on DetailsScreen.
- Set its Text property to "Back".
- Set its OnSelect property to:
Back()
- Repeat the same steps for SettingsScreen.
This setup
allows users to navigate back to the previous screen they visited, whether they
came from HomeScreen, DetailsScreen, or SettingsScreen.
Back() and Navigate() function with If-else in canvas app
- You have 3
screens.
- Screen1,
Screen2, Screen3.
- Based on a condition, you want
to navigate between these screens or go back to the previous screen.
Script:
If(
Dropdown1.Selected.Value = "Option
1",
Navigate(Screen2),
If(
Dropdown1.Selected.Value = "Option
2",
Navigate(Screen3),
Back()
)
)