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

  • The canvas app must be in a solution.

  • 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 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.

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.

  1. Sign in to Power Apps.

  2. In the left side panel, select Tables.

  3. Select a table, and then select Edit.

  4. Select Edit table properties.

  5. Select Advanced options, and then scroll to the Rows in this table section.

  6. Select Can be taken offline.

    Screenshot of the table editing options, with **Can be taken offline** highlighted.

  7. Select Save.

Turn on offline capability for your app

  1. In Power Apps Studio, in the left side panel, select Apps.

  2. Select your canvas app, and then select Edit.

  3. Select Settings.

  4. Select General.

  5. 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.

  6. 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.
  7. 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

If you're turning on offline capability for a brand-new canvas app, make sure the default first screen is based on the Offline template.

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.

  1. Sign in to the Power Platform admin center using an admin account.

  2. In the left side panel, select Environments.

  3. Select an environment, and then select Settings.

  4. Expand Users + permissions, and then select Mobile configuration.

  5. Select Create new profile.

  6. Enter a name and description, and then select Create.

  7. 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 table in the profile.

  1. In the Data available offline section, select Add table.

  2. Select a table, and then define the filters.

  3. Select Next.

  4. Set the following filters:

    1. Choose the row that you want to make available offline. For the Custom option, use the expression builder to set up advanced conditions.

    2. 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.

    3. 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.

  5. 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.

  1. Create a model-driven app in your test environment that uses the same tables as your canvas app.
  2. Set up the model-driven app for offline use.
  3. Generate a default profile and add tables with filters.
  4. Publish the model-driven app.
  5. 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.

Screenshot of a page based on the Offline template shown in the Power Apps Studio canvas.

You can also add a new page based on the Offline template the same way you add pages from any other template.

Screenshot of the Templates gallery, with the Offline template highlighted.

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 export the offline profile for the app, as it is a dependency of the app.

  1. Sign in to Power Apps and in the left navigation pane, select Solutions.
  2. Select the solution that you want to export and then select Edit.
  3. 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.

See also