Skip to content

Power Apps

Force App Updates In Power Apps

Force App Updates In Power Apps Posted by - Matthew Devaney on - May 2, 2021 31 Comments I’m pretty sure every Power Apps maker has experienced publishing an...

Matthew Devaney
Published
Reading time
5 min read

Before you start

Is this guide for you?

Best entry point
Power Apps
Time investment
5 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/force-app-updates-in-power-apps/. Author: Matthew Devaney.

Force App Updates In Power Apps Posted by - Matthew Devaney on - May 2, 2021 31 Comments

I’m pretty sure every Power Apps maker has experienced publishing an app update but the end-user doesn’t receive it. There a few reasons why this might happen including the device has the old version stored in cache or the user didn’t click on the update prompt at the top of the screen (why is that optional?). Today I’m going to share a solution with you designed by my good friend Gareth Prisk . In this article I will show you how to force app updates in Power Apps so you’ll never have to worry about it again. Table of Contents Introduction: The Inspections App Power Apps Versions SharePoint List The Four Screens Approach #1 – Loading Screen #2 – Success Screen #3 – Incorrect Version Screen #4 – Admin Screen Checking The App Version Making An App Update Introduction: The Inspections App

The inspections app is used by mechanics at an automobile parts manufacturer to log the results of equipment inspections. When the I/T department publishes an updated app the mechanics receive a new version of it on their device. If the app fails to update for any reason the mechanic is not allowed to proceed with the inspection and is prompted to force an app update by following a set of simple instructions. Power Apps Versions SharePoint List

Start Create a new SharePoint List called Power Apps Versions with two columns:

Title (single-line text) – name of the app

VersionNumber (text) – current app version number Input the following data: Title VersionNumber Inspections App 1.0 Photos App 1.3 Quotes App 2.5

In this example we are making the Inspections App together but I wanted to show this table can hold the version number for as many apps as you like. The Four Screens Approach

The inspections app has four screens. Before writing any code we will design each one of them. Loading Screen Success Screen Incorrect Version Screen Admin Screen #1 – Loading Screen

Open Power Apps Studio and create a new app from blank called Inspections App . Make a new screen called Loading Screen.

When the mechanic opens the app this is the first screen they see. The app checks to make sure the version number matches the current version in the SharePoint List then it loads any required data.

We’ll get back to the code version checking code soon. For now just design the screen. If you like you can make it look fancy with loading spinners or a progress bar .

To set the app version number put this code inside the OnStart property of the app. Set (varAppVersion, "1.00" ); Code language: JavaScript ( javascript )

Then use this code in the text property of the version number label. "v" &varAppVersion Code language: JavaScript ( javascript ) #2 – Success Screen

If the app version number on the device is the current published version number the app data will begin to load and the mechanic will see a success message. Make a simple screen that looks like the one below. #3 – Incorrect Version Screen

If the app version on the device does not match the current published version number a warning message will appear. The screen below shows the mechanic instructions on how to force an app update on a tablet/phone.

Forcing an app update on a desktop/laptop computer is done different. Although our example uses a tablet I’ve made a sample screen below. #4 – Admin Screen

The mechanic never sees this screen but it is important for the app maker to have a way to disable the app’s loading process. Loading starts automatically so without an off switch the app would never allow edits after the 1st version.

Place a toggle on the screen called tog_AutoLoad ….

…and set the Default property of the button to true. Then immediately press the toggle and set it to false . We need to disable the autoload while we write the version checking code. true Code language: JavaScript ( javascript ) Checking The App Version

Now that we’ve created all of the required screens go back to the loading screen and insert a button called btn_Loading_Process.

When mechanic opens the app it triggers the button is automatically pressed. Write this code in the OnVisible property of the Loading Screen . If ( tog_Autoload .Value , Select ( btn_Loading_Process ) ) Code language: CSS ( css )

Then write this code in the OnSelect property of the button. If the app version number matches the current version number in SharePoint the success screen will be shown, otherwise, If( varAppVersion = LookUp(

'Power Apps Versions' , Title = "Inspections App" , VersionNumber ), Navigate( 'Success Screen' ), Navigate( 'Incorrect Version Screen (Tablet)' ) ) Code language: JavaScript ( javascript )

Make sure to set the Visible property of the button to false. The mechanic doesn’t need to see it. false Code language: JavaScript ( javascript )

That’s it, we’re done! Go ahead & test the Inspections App with a matching version number and a non-matching version number to make sure it works. Making An App Update

Remember, with the forced updates system in place everytime a new app version is released you must:

Increment the app version in the OnStart property to the next number.

Update the Power Apps Versions SharePoint List with the matching number.

This doesn’t mean you have to do it each time the app is published. Rather, you should change the version when transferring an app from your development environment to the production environment. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about Force App Updates In Power Apps please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney M365 Copilot Power Apps

How To Create Copilot Custom UI Widgets In Power Apps

Share this

Tagged

Power Apps

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →