Why?
Microsoft has improved the Environment Variable experience a lot since my last blog posts on this topic (Power Platform: update Current Value of an Environment Variable in a Managed Solution). Even the documentation has a lot more details now (Use environment variables in solutions – Power Apps | Microsoft Docs). However there is still some inconsistency when importing Managed Solutions into an environment when it comes to a Current Value of an Environment Variable.
What?
This post will show how to verify the Current Value of an Environment Variable in a Managed Solution. Even if you did not remove it before exporting or if there is none at all, you can easily add or modify the desired Current Value in case the import wizard did not help you with this 🤓.
How?
Expected behavior
Basically I expect a prompt for a Current Value of an Environment Variable when I import a brand new Managed Solution with Environment Variables into a Power Platform Dataverse environment:
After I complete the prompt, the Managed Solution interface shows the Current Value below the Default Value in the Environment Variable Definition. Below you will see my example of the Center of Excellence Starter Kit:
The documentation states:
“You will not be prompted for new values during solution import if the environment variables already have either a default value or value present; whether values are part of your solution or are already present in the target environment.“
So if it is a brand new Solution where the Current Value was removed before exporting, the prompt should always occur right? Wrong!
Most of my import experiences do not come with a prompt, even though I definitely removed the Current Value from the Unmanaged Solution before exporting it as a Managed Solution 🤯.
Actual experience
I created a simple Solution with only 6 environment variables of all the scenario’s I could think of:
- Decimal and Text are (as instructed in documentation) Environment Variables with Current Value removed before exporting
- the …Not Removed versions are with Current Value kept intact before exporting
- the …Default Only are without ever having any Current Value at all
None of the scenario’s gave me a prompt in the target environment and only the …Not Removed versions showed me a Current Value in this Managed Solution interface:
However non the scenario’s gave me a way to update the Current Value from within the Managed Solution interface 😒.
Let me show you how to verify / edit / add the Current Value of an Environment Variable for any of these three scenario’s:
1) Go to the Tables section of your Power Platform Environment and select the Environment Variable Definition table:
2) Edit the definition for which you want to verify / add / edit the Current Value:
3) See the subgrid on the bottom showing the Current Value. Here is where you can add a new Current Value or edit an existing Current Value 💪👍. For all scenario’s this is the way to verify the Current Value. You just need to be aware the related tables and the created dependencies.
Based on this experience, I even prefer to leave the Current Value in the solution before exporting. That way we see the (most) Current Value in the Managed Solution interface 😁.
How can we use environment variable for SQL server? It seems we have no way to change SQL server name and DB name in a managed solution?
Connection References in Power Platform Solutions are the way to use a different SQL Server / Database name in a different environment for a different Solution.
You can update any variable in any solution by going the to the Default Solution where you will find all your variables. Update it there and you are done.
Thanx Brian!
I like the Tables section better because of all Tables of the Environment being there (also the ones not in the Default Solution). Do you have any tips on making sure the Current Value prompt of a new Environment Variable is shown??
Brian, that’s not accurate. That does not work for managed solutions.