Offline Capabilities in the Canvas app within Dynamics 365 – Part 1

Canvas Apps, a pillar of Power Platform, allows users to design apps with a focus on user experience and functionality. The “Mobile Offline” feature extends the capabilities of Canvas Apps by enabling offline usage.

Users can now interact with Canvas Apps seamlessly even in environments with limited or no internet connectivity. The app synchronizes data when a connection is available, ensuring uninterrupted productivity.

Here is a scenario, if the user or technician arrives at the location and suddenly his/her internet connection is lost, it will be difficult for him to work without the internet. However, now, it is a possibility with the canvas app’s offline functionality.

The intelligent sync mechanism of this feature ensures that data changes made offline are synchronized efficiently when the device reconnects to the internet. This ensures data consistency across different user devices.

Mobile Offline for Canvas Apps enhances productivity by allowing users to work in various scenarios, including remote locations or areas with unstable network connections.

Unlocking the power of offline usage is now simpler than ever. Previously achieved through complex fx formulas, for a detailed guide on implementing offline support using fx formulas in Dynamics 365 CRM, please refer to https://www.inogic.com/blog/2018/07/implement-offline-support-for-canvas-app-in-dynamics-365-crm/. Now Power Platform has introduced a built-in functionality for using Canvas Apps offline, further enhancing the user experience and eliminating the need for complex formulas.

Enabling the “Mobile Offline” feature for your Canvas Apps is a straightforward process. Follow these steps to unlock the power of offline usage:

Note: To work with the data offline in the canvas app the respective table must be enabled for offline use.

To enable the table to work in the offline mode follow the steps given below,

Initially navigate to the Power App look for the Tables from the site map and select the table that you want to enable to work offline, after selecting the table click on the Properties button.

Thereafter a floating window will open, on that window, we need to check “Can be taken offline” and press the save button.

Offline Capabilities in the Canvas app within Dynamics 365

Let’s proceed to create the Canvas app, creating an app from the solution.

Locate and open the solution, on which you want to create the canvas app and click on New => App => Canvas app,

Offline Capabilities in the Canvas app within Dynamics 365

 After Clicking on the Canvas App one Popup window will appear on which we can name our app and choose the Format of the App,

Offline Capabilities in the Canvas app within Dynamics 365

After that, we can select options to add the gallery or form on the default screen or we can skip.

Offline Capabilities in the Canvas app within Dynamics 365

Now the most important part is to enable the canvas app for offline,

Offline Capabilities in the Canvas app within Dynamics 365

Go to the Upcoming features and On the Dataverese offline option,

Offline Capabilities in the Canvas app within Dynamics 365

Go to the General and On the Can be used offline (Preview) and choose Offline profile on which the entity is present with which you want to work in offline mode, Auto-generate is selected default which will create the Offline Profile with the entity used in the Canvas app.

Offline Capabilities in the Canvas app within Dynamics 365

Below is the screenshot of how the offline profile will look which is created when we select Auto-Generate in the offline profile,

Offline Capabilities in the Canvas app within Dynamics 365

After all those settings, one Offline data sync screen will be added to the app automatically with the Globe icon, which will indicate the data connectivity status in the Mobile app.

Offline Capabilities in the Canvas app within Dynamics 365

Below is the default ‘fx’ of the globe icon, we can change the messages as per our requirement that have been written in double quotes, Let’s see this with an example by changing the messages further in this blog.

Switch(Connection.Sync,

ConnectionSync.Connected, Notify(“Your device is connected to the network, and your app is ready to work offline.”,NotificationType.Success),

ConnectionSync.ConnectedWithWarning, Notify(Connection.LastSyncMessage,NotificationType.Warning),

ConnectionSync.ConnectedPendingUpsync, Notify(“Some data on your device must be synchronized with the server.”,NotificationType.Warning),

ConnectionSync.ConnectedError, Notify(Connection.LastSyncMessage,NotificationType.Error),

ConnectionSync.ConnectedRefresh, Notify(“Your app is currently synchronizing data with the server.”,NotificationType.Information),

ConnectionSync.NotConnected, Notify(“Your device is not connected to the network, but you can keep using this app.”,NotificationType.Success),

ConnectionSync.NotConnectedWithWarning, Notify(Connection.LastSyncMessage,NotificationType.Warning),

ConnectionSync.NotConnectedPendingUpsync, Notify(“Some data on your device must be synchronized with the server. Reconnect to the network to synchronize.”,NotificationType.Warning),

ConnectionSync.NotConnectedSyncError, Notify(Connection.LastSyncMessage,NotificationType.Error))

Now we will take one example to check if we can work on the mobile app with the creation of a record in offline mode,

We will take one example of creating the Customer record in offline mode,

I have added one form with Data Source as an Account and added one Submit  button,

Offline Capabilities in the Canvas app within Dynamics 365

After saving and publishing the Canvas App, we will check the Mobile view of the app and it will start working offline at the same.

When we launch the App in the mobile App we will see the notification ‘This app may now be used without an internet connection’,

Offline Capabilities in the Canvas app within Dynamics 365

Now Let us try to change the Notification Message for the app connected to the Internet. The default message was “Your device is connected to the network, and your app is ready to work offline.” And will change this to “Your device has network connectivity, and your application is prepared to function offline.”.

This will be reflected below in the canvas app,

Offline Capabilities in the Canvas app within Dynamics 365

If we disconnect the internet and click on the globe icon then we can see the  notification “Your device is not connected to the network, but you can keep using this app.”,

Offline Capabilities in the Canvas app within Dynamics 365

In the below screenshot, we have added some data to create a Customer record in offline mode,

Offline Capabilities in the Canvas app within Dynamics 365

After adding the data if we click on the submit button and click on the globe icon it will show the notification message as “Some data on your device must be synchronized with the server. Reconnect to the network to synchronize”,

Offline Capabilities in the Canvas app within Dynamics 365

After submitting the form in offline mode if we connect to the internet then we can see the notification message as “Your app is currently synchronizing data with the server.” and it will synchronize the data automatically,

Offline Capabilities in the Canvas app within Dynamics 365

In the below screenshot, we can see one  Customer record is created with the Data we have  provided in offline mode,

Offline Capabilities in the Canvas app within Dynamics 365

Note:- To synchronize data, the application must be open, if a record is created in offline mode and the device connects to the internet while the application is closed, the record will not be added to CRM until the app is reopened, allowing data synchronization over an internet connection.

Conclusion

The “Mobile Offline for Canvas Apps (Preview)” feature serves as a pivotal component of the Power Platform, empowering users to design apps that prioritize both user experience and functionality. This functionality addresses the challenges posed by limited or no internet connectivity, enabling seamless interactions even in remote or unstable network environments. By embracing offline functionality, Canvas Apps are breaking barriers and providing users with a more flexible and robust app experience.

Canvas App

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *