Reusable PowerApps Control Templates
Does PowerApps support control templates? For example, imagine I am a company and I want a standard header or footer in all PowerApps that my employees make. Or perhaps I built some non-trivial piece of functionality like a calendar view that I want to use in many apps. Can I avoid duplicated effort?
So far there have been a few partial solutions or workarounds for this. PowerApps recently added support for copy / paste operations across tabs in PowerApps Web Studio which enables you to open an app, copy controls, then paste onto a new app.
This blog post introduces a tool I wrote to make it easier to share portions of an app. I refer to these as control templates.
Here it is: https://patemplates.azurewebsites.net/
Using a template
Say you want to add a calendar view like the one from my previous blog post here. I created a template for it, so now you can do it in 3 easy steps:
- Open the template: https://patemplates.azurewebsites.net/templates/4b77bfd8-811e-4a41-88d3-c129b96f2d2d
- When the page loads, press Ctrl+C (copy). The template is now copied to your clipboard
- In your app in Web Studio, press Ctrl+V (paste)
That's it! Compare this to having to either reproduce each step in that blog post, or having to download the sample app, copying several controls and formulas, etc.
Creating a template
Creating your own template is just as easy.
- In Web Studio, select the controls you want to templatize and press Ctrl+C (copy)
- Open https://patemplates.azurewebsites.net and press Ctrl+V (paste)
- Done! You will get a link to your new template.
Note: your template will be stored and made available publicly to anyone who has the link. You should always assume any templates you create are public -- do not use this if you have sensitive information in your formulas.
Nice and easy. There are, however, limitations:
- Data sources are not copied. If you copy controls that access external data, you will have to set up the data sources in order to use the templates correctly
- Media are not copied. If your template includes an image / video / audio control with media that was embedded on your app, the media will not be part of the template
- You may have to recreate your templates from time to time as PowerApps releases new versions. If you start seeing issues, just open the app that has the controls you care about, and create a new template from them.
- Only Edge and Chrome are supported.
You might see warning signs on some formulas until you manually fix any issues caused by the above.
I built this tool for myself as a PowerApps blog author -- now I can more easily share content for the community to consume. I hope that by sharing this tool others will also benefit. It should be obvious that this tool is not an official Microsoft product. While I intend to do my best to keep it running and operational, you shouldn't expect the same level of polish and reliability as PowerApps itself.
What do you think? Share your thoughts or feedback below!