App-level triggers in canvas apps are events that can be used to perform specific actions or automate tasks in response to certain user interactions or system events within the app. These triggers are available for use across all screens within the app and can be set up from the app settings.
There are several types of app-level triggers in canvas apps, including:
- OnStart: This trigger runs when the app is launched and can be used to perform any initialization tasks, such as setting default values or initializing global variables.
- OnVisible: This trigger runs when a screen becomes visible to the user and can be used to perform actions specific to that screen, such as fetching data from a data source.
- OnHidden: This trigger runs when a screen is hidden from the user and can be used to clean up any resources or data specific to that screen.
- OnTimerEnd: This trigger runs when a timer that was previously started using the Timer control on a screen has ended.
- OnSelect: This trigger runs when a user selects a control, such as a button or a gallery item, and can be used to perform specific actions based on the user’s interaction.
- OnChange: This trigger runs when a user changes the value of a control, such as a text input or a dropdown, and can be used to perform actions based on the user’s input.
- OnReset: This trigger runs when a user resets a form or control, and can be used to clear any data or reset any values as needed.
To set up an app-level trigger in your canvas app, follow these steps:
- Open your canvas app in the Power Apps Studio.
- Go to the File menu and select App settings.
- In the App settings pane, select the Events tab.
- Select the type of event you want to set up a trigger for, such as OnStart or OnVisible.
- Choose the action you want to perform in response to the event, such as running a formula or navigating to a different screen.
- Save the trigger and publish your app to make the changes effective.
Once the app-level trigger is set up, it will run automatically in response to the specified event, allowing you to automate tasks and provide a more user-friendly experience within your canvas app.