top of page
Search

Getting started with Power Apps Solutions and Environment Variables

Updated: Jan 17

This post is for you if:

• You build Power Apps or Power Automate flows that you want to move between environments or tenants

• You are trying to understand the building blocks of Application Lifecycle Management (ALM) in the Power Platform

• You use SharePoint as a data source, and you want to quickly change the site or list that your app or flow is connected to


If you don’t like reading, then you can always watch SharePoint Environment Variables for Power Apps and Automate Solutions video on YouTube. It goes more into detail and gets all the step-by-step fun.


Note: Solutions are a massive topic with many nooks and crannies. This post is focused on Power Apps Solutions built that use SharePoint Environment Variables only and in no way is exhaustive. Heck, I am exhausted just trying to write this one scenario. 😁


What are Solutions in Power Apps and Power Automate?

Solutions are a way to package up your apps and flows and all the supporting pieces so that you can move them from one Environment to another. If you have intentions of making your work portable or doing ALM then you need to learn to love solutions.


What can be packaged in a solution?

Power Platform solutions can contain the big things like Power Apps Canvas Apps and Model-driven Apps, Power Automate cloud flows, Power Virtual Agent Chatbots, and Power Bi Dashboards and Reports. But it also lets you take along some key Dataverse pieces like Table definitions, Choices, and Security roles to name a few things.


But what if you are using a different data source like ole faithful SharePoint? You cannot include your SharePoint lists but what you can do is leverage Environment Variables and Connection References. This allows you to build your app or flow to use the variable as a data source. Then when you move your app or flow to a new environment you can change where the variable points are. Boom. Now you are mapped to a different list or table without having to rework your app or flow. Very powerful stuff.


So now you can build an app/flow to work with your dev copy of the SharePoint list on the dev site. Build and test as you see fit. Done? Great, now export your solution and when you import into your production environment you repoint the Environment Variables, and everything works. You can map a different site and list.


What is a Managed Solution vs. an Unmanaged Solution?

Long story short? Managed solutions are ones where you make all changes to your app, flow, or other Solution pieces from a dev environment. Then when you import it to another environment the pieces are available, but they are not editable. Unmanaged are the opposite. When you import the solution into another environment everything is editable. One point of confusion. You don’t set a Solutions type when you create it, only when you export it. So, your decision is not locked in, every time you export you get to choose.


When should you use Power Apps Solutions?

This answer will be a tad controversial. 😁 But here are some answers based on my opinion and experience.


If you are building a Model-driven application, then you should always use Solutions. Solutions were originally born for Model-driven and Dataverse and they work the best in those scenarios. There is a lot of goofiness that you will trip over if you try to build them outside of Solutions actually.


Do you want to build parent child power automate cloud flows? Then those have to be built in a solution, that is literally the only way the action you need is available. More details in this video on Power Automate child flows.


What about Canvas apps and Cloud flows? In my opinion I am only building them in Solutions if I want them to be completely portable. So, if I was doing ALM scenarios then yes. But if you are building your apps in production and don’t plan to move them anywhere then say no thank you to Solutions. Why? Because Solutions introduce more moving parts and hoops to jump through, no reason to deal with them if you don’t plan to leverage their functionality. Controversial? Probably. Practical advice? Absolutely.


Now keep in mind that my advice here isn’t forever. Microsoft continues to improve Power Platform Solutions and at some point, using them 100% of the time will probably be the norm, that norm just isn’t today.


Overview of how to build a Power Apps Solution with Environment Variables

Now that you have a solid understanding of what Power Platform Solutions are and when to use them let's go over at a high level how you would use them. Remember you can see the steps in action by jumping over to YouTube and using our video on Power Platform Solutions and Environment Variables. There are timestamps in the video description if you want to jump to a specific portion.


Create a Solution

To get started go to Make.PowerApps.com and on the left click on Solutions. Then from the top bar click on New solution. Here you can provide a Display name, select a Publisher (use the Default publisher if you are unsure), and then hit Create. After a few seconds you will have a new empty solution ready to go.


Create an App in your Solution

From the top bar click on New > App > Canvas app. Provide an App Name, the Format, and click Create. This will take you to the Power Apps studio you are used to. Now click on Settings, scroll down a bit, and enable Automatically create environment variables when adding data sources. Be sure then to save and refresh. Now open your app up again and add your SharePoint list as a data source when you do so it will automatically create your Environment Variables. 🙂 Very cool. Be sure to note the name of the Site and List variables that it is creating for you. Now build your app out to meet your needs. Save and close when you are done.


Create a Power Automate cloud flow in your Solution

From within your Solution click on New > Automation > Cloud flow > Instant flow. Give your flow a name, choose the manual trigger, and click Create. Add the SharePoint action Get items and for Site Address choose Enter a custom value from the dropdown. Now in your list of Environment Variables choose the Site environment variable you created when adding your data source to your canvas app. For List Name it is the same process; choose Enter a custom value from the dropdown but this time choose your list Environment Variable. Make any other customizations you want to your flow, Save your flow, and close so you return to your Solution.


There you go, you now have an App and a flow in your Solution wired up and ready to go. Congratulations.


Get ready to Export your Power Platform Solution

To make importing your Solution more wizard like you will want to edit your environment variables before you export. From the Solutions Objects screen (where you see all of the apps, flows, environment variables, etc.) click on your List Environment Variable. From the property panel that opens on the right look at Current List dropdown and click the … to the right. Here select Remove from this solution and close the panel. Repeat the same steps for the Site Environment Variable. By taking these two steps it will force the Import process to prompt you to choose a new list and site.


Export the Power Platform Solution

On the far left click on Overview. This screen shows you all of the details about your Solution. In the top bar click on Export. Click the Next button from the property panel on the right. Choose either Managed or Unmanaged Solution and click Export. After a minute or so you will see a green bar across the top of the screen where you can click Download. This is your Solution.


Importing your Power Apps Solution

Now that you have created your Power Platform Solution you can import it anywhere you want. Most likely you will at a minimum want to switch to a different Power Apps Environment. Then from the left click on Solutions and from the Top Bar click on Import solution. From the right panel click on Browse to find the Solution you previously imported and click Next. The first screen will have details about the Solution click Next. Then you will be prompted to connect your Connection References, choose your SharePoint connection and click Next. Now for Environment Variables you need to select your Site and List then click Import.


If you need help implementing this solution or have any questions about the Power Platform, please check out our Services or fill out the contact form below. We can assist you with everything from fixing one small problem to taking on full-scale projects. We even offer mentoring and Power Platform Training if learning is your top priority. So don't hesitate to reach out and let us help you make the most of your Power Apps experience!


If you prefer to learn on your own, there is a downloadable app included with this video in our YouTube training library for only $15/month!


Also, there is so much more to learn about Power Platform Solutions and SharePoint Environment Variables, but this guide hopefully gets you started well.


Shane



2,655 views

Comments


bottom of page