Monday, August 02, 2021

Leverage environment variables in Power Platform and Dynamics 365 projects

Environment variables allow you to easily add configuration data with Power Platform solutions  and use them in different solution components such as canvas apps, Power Automate cloud flows and model driven apps. Environment variables are a fairly new component type and were introduced in public preview in November 2019 and released in GA around summer 2020.  They are a good alternative for the typical custom "configuration entity/table" that you use in a project -  check out Why you should use environment variables for some practical experience around it.


The new solution import experience supports setting environment variables during the import of the solution but it will only do it when you did not set the default value or a current value so don't forget to remove the current value (click on the "..." next to the current value to remove before exporting your managed solution) as documented on Enter new values while importing solutions. On the target environment where you import your managed solution, you will see a red bar appearing if there are environment variables missing values.



You will be able to use the created environment variables within all different types of Power Platform components but so far I have used it mainly in Power Automate cloud flows where you can use environment variables in expressions  (see screenshot below) - see references section for other example use cases.





References:






No comments: