Set up mobile offline for canvas apps
Turn on offline mode in your canvas app if users need to work without worrying about their Internet connection.
Prerequisites
You must have the Environment Maker, System Administrator, or System Customizer role to set up offline mode for canvas apps. These roles have create, read, write, delete, and share privileges on Canvas App, Mobile offline profile, and Sync Error tables. Learn about predefined security roles.
Users with the Basic User role can't open an offline application. You must create a custom security role with read privileges on Canvas App, Mobile offline profile, and Sync Error tables.
If you already have a custom security role, make sure it grants read privileges on Canvas App, Mobile offline profile, and Sync Error tables. Learn about Create or edit a security role to manage access.
Note
It's recommended that the canvas app is in a solution. The offline profile App usage field in the Power Platform admin center (Environements > select an environment > Settings > User + permissions > Mobile configuration) only applies to apps within a solution.
Optimize your app for mobile offline
Mobile apps run on small screens with limited connectivity. Before you set up offline mode, make sure your canvas app is optimized for offline and mobile use. Consider the user scenarios you want to cover and the amount of data the app uses. Create an app that's simple and lightweight.
Follow these best practices when you build an app for mobile offline use:
Performance is critical when you run an app on mobile. For more information about creating performant canvas apps, see Overview of creating performant apps.
Identify the on-the-go scenarios that are functionally related, such as tasks that are performed by users who work in the field.
Reduce the complexity of your app by limiting the number of tables that need to be downloaded. Sometimes it's better to have two apps instead of one.
Use views that are optimized for the experience rather than displaying a large set of data. For example, it's preferable to use the My active accounts view, rather than the All accounts view.
Turn on offline capability for tables
Tables included in an offline app must be configured for offline use. Some built-in tables have it by default. Some tables can't be used offline. However, you can turn on offline capability for any new, custom table.
Sign in to Power Apps.
In the left side panel, select Tables.
Select a table, and then select Edit.
Select Edit table properties.
Select Advanced options, and then scroll to the Rows in this table section.
Select Can be taken offline.
Select Save.
Turn on offline capability for your app
In Power Apps Studio, in the left side panel, select Apps.
Select your canvas app, and then select Edit.
Select Settings.
Select General.
Turn on the Can be used offline option.
If you don't see the Can be used offline option, make sure the app is in a solution.
Select an offline profile. You have two options:
- Use an autogenerated profile. This setting downloads the tables that are used in your app and is the recommended option.
- Create a custom, mobile offline profile, select the Refresh icon to see your new profile in the list, and then select it.
Close the Settings window, and then save and publish your app.
A page that's based on the Offline template is automatically inserted in the app. The page contains an icon that uses the Connection Power Fx function to reflect the app's offline sync status. You can use it as-is or customize it, as appropriate.
Note
You can use the same, offline profile in different canvas apps. The users can use the apps and share the same, offline profile in disconnected mode. The updates done in one app are reflected in the other apps since the apps share the same, local storage with this set up.
Create a custom mobile offline profile (with admin rights)
If the automatically generated offline profile doesn't meet your needs, create your own. Learn about guidelines for offline profiles.
You need to publish your new offline profile before you can select it in your canvas app's settings. If you edit and publish an offline profile, you must also publish any canvas apps that use it.
Sign in to the Power Platform admin center using an admin account.
In the left side panel, select Environments.
Select an environment, and then select Settings.
Expand Users + permissions, and then select Mobile configuration.
Select Create new profile.
Enter a name and description, and then select Create.
After the profile is created, select it to continue editing it.
Add a table to an offline profile and apply filters
Applying an appropriate filter for each of the tables configured in the offline profile is critical to limiting the amount of data that downloads on users' devices.
Be sure that you configure at least one of the profile rules for each table to download its data.
Customization | Recommendation |
---|---|
Organization rows - if selected, then select at least one of these options: - User's rows - Team rows - Business unit rows |
If you want to define this filter, then you have to pick at least one of the given options. It's highly recommended to not have a business unit-level filter for a table, unless there's a strong justification. It's recommended for a master data scenario with a small data set, like country codes. |
All rows | If you select this filter, you can't define any other filter rules. |
Related rows only | Be sure that the related table has been added to the offline profile. |
Custom | You can define a custom filter up to three levels deep. |
Keep in mind that you can have 15 related tables in a custom filter. You can also have 15 relationships. The 15-relationships limit is transitive, meaning if table B has N relationships, and you add a reference to table B in table A, then it increases the relationship count of A by N+1; one plus the N already in table B. This limit is per profile item for a table in the profile.
In the Data available offline section, select Add table.
Select a table, and then define the filters.
Select Next.
Set the following filters:
Choose the row that you want to make available offline. For the Custom option, use the expression builder to set up advanced conditions.
Relationships lists the different relationships available between the current table and other tables added in the offline profile. Selecting a relationship ensures that related rows following that relationship are downloaded and made available offline. You can only have up to 15 related tables in a profile. If you exceed the limit, you get an error and won't be able to publish the offline profile.
Sync interval defines the sync frequency to be applied on the device that syncs with the data with the server. If a table's data doesn't change frequently, like a catalog or a product table, you might want to focus on only syncing data when necessary, such as refreshing only once a day.
Select Save.
Important
Don't add users in the offline profile in the Users with offline access area. This capability is only applicable to model-driven apps and is restricted to selected users.
Create a custom mobile offline profile (without admin rights)
If your Power Apps account doesn't have admin rights, you can still create a mobile offline profile. Coming soon, you'll be able to create an offline profile directly in Power Apps Studio. Until then, use this workaround.
Create a model-driven app in your test environment that uses the same tables as your canvas app.
Publish the model-driven app.
Select the offline profile in your canvas app.
Using the Offline template and offline status icon
To make it easier to create or convert a canvas app for offline use, we created the Offline template. The template includes a globe icon in the navigation bar that shows the connectivity and sync state, putting offline at the center of the experience. Users always know whether their device and data are ready to go.
A new page created from the Offline template is automatically inserted as soon as you turn on the offline capability in your canvas app.
You can also add a new page based on the Offline template the same way you add pages from any other template.
The globe icon in the template's navigation bar uses different icons depending on the value of the Power Fx Connection.Sync
function. You can create your own icon and set the Icon property using the following Power Fx script:
Switch(Connection.Sync,
ConnectionSync.Connected, Icon.Globe,
ConnectionSync.ConnectedWithWarning, Icon.GlobeWarning,
ConnectionSync.ConnectedPendingUpsync, Icon.GlobeChangesPending,
ConnectionSync.ConnectedError, Icon.GlobeError,
ConnectionSync.ConnectedRefresh, Icon.GlobeRefresh,
ConnectionSync.NotConnected, Icon.GlobeNotConnected,
ConnectionSync.NotConnectedWithWarning, Icon.GlobeWarning,
ConnectionSync.NotConnectedPendingUpsync, Icon.GlobeChangesPending,
ConnectionSync.NotConnectedSyncError, Icon.GlobeError)
You can set the OnSelect property using the Power Fx function ShowHostInfo
to show the Device status page when selecting the globe icon.
ShowHostInfo(HostInfo.OfflineSync)
You can set the Visible property using the Power Fx function Host
to only show the globe icon when the app is used on a player that is supporting the offline mode.
Host.OfflineEnabled
Export a solution that contains a canvas app enabled for offline
When you export a solution with an offline canvas app, you also need to export the offline profile for the app, as it is a dependency of the app.
Sign in to Power Apps and in the left navigation pane, select Solutions.
Select the solution that you want to export and then select Edit.
Select the canvas app that is enabled for offline and then select Advanced > Add required objects.
Make sure that the associated offline profile is in the solution and then you can export it.