Using Environment Variables in Power Automate and Canvas Apps

Here’s how you can use Environment Variables in your environment in Power Automate and Canvas Apps!

In case you are looking to create Environment Variables, here’s the post: Environment Variables in Power Apps and Power Automate

Power Automate

Here’s how you can use Environment Variables in a Flow –

  1. You can’t use/access Environment Variables in a Flow which is not in a solution –
    Environment Variables are accessible in the Dynamic Content section on the very top of the list. [Since the below Flow is outside a Solution, you can’t see the Environment Variables]

  2. Now, this Flow is within a Solution –

  3. And then you access the Dynamic Content, you can see the Environment Variables.

  4. And when you Run the Flow, the Environment Variable will show the value based on the Data Type set for the variable at appropriate places –

Canvas Apps

Unlike Power Automate Flow, Environment Variables in Canvas Apps can be utilized even if the Canvas App was created outside a solution –

  1. In a Canvas App, click to Add Data Source.

  2. On the Environment Variable Definitions/Values is added to the Canvas App as Data Sources, let’s take a simple Text control to read the Value from the Environment Variable used in the above Flow example –
    I’ll use Lookup() function in Power Automate to fetch the value of the Environment Variable by it’s Schema Name
    Even if you only added Environment Variable Values table as Data Source, the Environment Variable Definition too will be added once you use the Lookup() function to fetch the value.

Hope this was useful!

Here are some Power Automate posts you want to check out –

  1. Environment Variables in Power Apps and Power Automate
  2. Select the item based on a key value using Filter Array in Power Automate
  3. Select values from an array using Select action in a Power Automate Flow
  4. Blocking Attachment Extensions in Dynamics 365 CRM
  5. Upgrade Dataverse for Teams Environment to Dataverse Environment
  6. Showing Sandbox or Non Production Apps in Power App mobile app
  7. Create a Power Apps Per User Plan Trial | Dataverse environment
  8. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  9. Co-presence in Power Automate | Multiple users working on a Flow
  10. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  11. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  12. Call a Flow from Canvas Power App and get back response | Power Platform\
  13. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  14. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  15. Asynchronous HTTP Response from a Flow | Power Automate
  16. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  17. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

Advertisement

Environment Variables in Power Apps and Power Automate

Here’s how you can create Environment Variables in Power Apps or Power Automate portal.

Creating Environment Variable in a Solution

First, create Solution to store your environment variable.

  1. In this example, I’m using Power Apps (https://make.powerapps.com/) to create a n Environment Variable.
    In the Solution, I can click on New and then look for an Environment variable.

  2. Below are the types of Environment variables which you can create –


  3. For example, I’m storing the current Org’s ID in an Environment Variable which I want to re-use in my Flow for whatever purpose (Just an example 🙂).
    I’ve given it a suitable name and stored the current value as well.

  4. And my Environment Variable will be created in a Solution in either Power Apps or Power Automate.

  5. Now that your Environment variable is ready, you can feel free to use it in Power Automate and Power Apps. Environment variables can be used in Flows and Canvas Apps which are in a solution.
    Here’s how you can use Environment Variables in Canvas Apps and Flow – Using Environment Variables in Power Automate and Canvas Apps

You can look at Microsoft’s Documentation on Environment Variables for more info – https://learn.microsoft.com/en-us/power-apps/maker/data-platform/environmentvariables?WT.mc_id=DX-MVP-5003911

Hope this was useful!

Here are some Power Automate posts you want to check out –

  1. Select the item based on a key value using Filter Array in Power Automate
  2. Select values from an array using Select action in a Power Automate Flow
  3. Blocking Attachment Extensions in Dynamics 365 CRM
  4. Upgrade Dataverse for Teams Environment to Dataverse Environment
  5. Showing Sandbox or Non Production Apps in Power App mobile app
  6. Create a Power Apps Per User Plan Trial | Dataverse environment
  7. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  8. Co-presence in Power Automate | Multiple users working on a Flow
  9. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  10. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  11. Call a Flow from Canvas Power App and get back response | Power Platform\
  12. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  13. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  14. Asynchronous HTTP Response from a Flow | Power Automate
  15. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  16. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!