Version Number in PowerApps
I’ve been working a lot with PowerApps at the moment, and one thing that came up as a requirement from a customer was the need to show the current published App Version within the app. You would think this would be an easy thing to display, but it’s (frustratingly) not as straightforward as you would imagine.
There is an open Idea in the Power Apps Community to give us the ability to get app metadata from within the app but it’s still not available, despite the idea being posted in July 2017 and Microsoft acknowledging the request and marking it as “PLANNED” in October 2018… so, for the moment, we need to work around the issue and I thought I would share the method I used, in case it helps one of you.
The first thing you’re going to need to do is add the “Power Apps for Makers” Data Source. Open your data sources by clicking on View and then Data Sources, then search for Power Apps For Makers and add it to your project. It’s worth noting that (at the time of writing this) the Power Apps for Makers connector is in preview.
The next thing we will need is the App ID. This is easy to get, just find the app in https://make.powerapps.com, click the 3 dots to the left of the app and select Settings.
On the details screen, you will find the App ID… make a note of it as we will need it later.
Now we have all the bits we need, we can start to work out the currently published app version. All of this code can happily live in the OnStart section of the overall app, meaning it will update each time the app is opened,
Firstly, we will use the PowerAppsforMakers connector to create a collection called “allAppVersions” which will hold all the app versions. This is where you will need your App ID.
ClearCollect(
allAppVersions,
PowerAppsforMakers.GetAppVersions("########-####-####-####-############").value
);
Once we’ve got that, we need to find the latest version which has been published – this is our currently published version, but it doesn’t hold the ID in the data, so we will use this to create a variable called publishedVersionDate.
Set(
publishedVersionDate,
First(
Sort(
Filter(
allAppVersions,
properties.lifeCycleId = "Published"
),
name,
Descending
)
).properties.appVersion
);
Now we can count how many versions there are before the currently published version to get the currently published app version number and store it in a variable called publishedAppVersion.
Set(
publishedAppVersion,
CountIf(
allAppVersions,
properties.appVersion <= publishedVersionDate
)
);
Now we can easily call those variables whenever we want to display the app version.
"App Version: " & publishedAppVersion & "
Release Date: " & publishedVersionDate
So that’s the easiest way I’ve found of displaying the version number in PowerApps… I’m not going to lie, it’s not as straightforward to do as it should be, but hopefully Microsoft will get an easier method sorted soon!
In the meantime, this should work for our needs. Please feel free to send me any questions you have and I’ll try my best to answer them.