When we apply updates to a Canvas PowerApp and publish the app, the updates are “automatically” applied to all installations of the app. The mechanism works great but it needs the user to open the app 2 times before receiving the update on mobile devices (most of the time). The first time the local install gets a signal that a new version is available (probably), the second time the app downloads and installs the updated version.
If you have communicated that updates are applied to the app this can be very unclear for the end-users. To avoid this situation you can add a version notification so the users are informed when they open an old version.
It is a quite simple solution. You register a version of the app in a label in the app and in the configuration source of the app. When the version does not match a dialog is shown, this article describes how to configure this solution.
I often use an external source to manage some configuration settings. See this blog post I have written about how to set this up: https://rubenvanputtenblog.wordpress.com/2017/12/11/centrally-manage-your-powerapp-styling/
So how to set this up
- You first create an external source to store you configuration (CDS, SQL, SharePoint or any other data source), in the example in this article the external source is called “Settings” and it is an entity in a CDS (Common Data Service).
- The source should contain a field to identify the record (in this example mcw_key) and a field with the value for the setting (in this example mcw_value).
- In this source we add an entry with key field “AppVersion” and with the value field containing the version number.
- You connect the PowerApp to the external source so it becomes available in the app.
- In the “On start” action from the app the configuration list must be loaded in a collection. ClearCollect(collConfiguration, Settings), this loads the data from the Settings source in a collection in the app.
- On the start screen I add a label to register the version number in the app.
So now we have the version number registered in two locations, in the app and in the configuration source. When we update the app we need to update the versions in both locations. When this is done the versions can be compared to determine if the app is an old version or the current version.
- Open the “On start” action, add the action:
Set(varOldVersion, If(LookUp(collConfiguration, mcw_key = “AppVersion”, mcw_value) = AppVersion.Text, false, true));
This action compares the version from the collection (actually the version in the external source) and the version in the AppVersion label, it sets the variable varOldversion to true if the versions defer and to false if the versions are the same.
This is great, now we have an indicator to work with. Because the variable contains true or false we can use this variable in the visible property of a dialog.
- Create a label with a message and two buttons to function as a dialog and grouped them together. The close button contains the action: “Exit()” and the Ignore button contains the action: Set(varOldVersion, false).
- To make the dialog work, select the group containing all elements and add the variable “varOldVersion” to the visible property.
Now the solution is complete, publish the app and you are done.