A new feature has landed within the Power Platform: data source environment variables. They can be used in Power Apps as well in Power Automate. In this blogpost we will focus in Power Automate. Microsoft mentions in their blogpost that it doesn’t use a premium feature/license which is great news.
When you’re developing some more advanced Power Platform solutions, you will have the need for DEV, TEST and PROD environments. For every environment, you can have a separate SharePoint site.
What is an advanced solution? Check Microsoft’s triangle to see if you need ALM (Application Lifecycle Management – DEV, TEST and PROD) or not.
If you want to move your solution from DEV to TEST, the SharePoint URL changes. Previously you had to change this URL manually for every SharePoint action in your solution when you deploy it to TEST or PROD. Microsoft announced the “data source environment variables”. From now on, you only need to update the url in one place which is great.
How it worked before
Before this new feature, you had to define a SharePoint site and list for every action.
How it works now
If you create a solution package, which you definitely need to do if you’re working in an ALM way, you can add data source environment variables.
In our example below we created two environment variables:
- One for the SharePoint site
- One for the SharePoint list
SharePoint site data source environment variable
If you select “Site” for the “Parameter Type” field, you can create a data source environment variable for the SharePoint site. You can use this environment variable within the next one for the SharePoint list.
SharePoint list data source environment variable
After defining the “Site” field using the previous environment variable, you can select a list on that site.
Using the environment variables within the flow
Add a new cloud flow to your solution package. Define a custom value instead of a static reference to the SharePoint site.
The data source environment variable that you created before now shows up:
Do the same for the SharePoint list.
Using data source environment variables has multiple advantages:
- Win time: No more updating of every SharePoint action
- Less mistakes: Just 1 place to define you SharePoint site details
- Managed solutions: You can use a managed solution package instead of an unmanaged solution package
“Data source environment variables” is a long awaited feature that is great to have!