Power Automate – Environment Variables

Background

Hello Everyone,

Today I am going to introduce to you about Environment Variables in Power Automate

We can use the site variable and list variable as site address and list name.When we import and export the Power Automate we have to change only connection and environment variable. While export the Power Automate i am facing some issue related to connection in other tenant

Background:

What are environment variable  ?    

  • Environment variable store the parameter keys, values which then serve as input to various other application objects. Separating the parameters from the consuming objects allow us to change the values within the same environment or when we migrate solutions to other environment.
  • Store configuration for the data source used in canvas app and flows. SharePoint Online site and list parameters can be stored as environment variables. Allowing us to connect to different sites and lists in different environment without needing to modify the apps and flows.

Advantage of environment variable –

If we need to retire a data source in production we can simply update the environment variable with new information for the new data source the app and flow do not require modification and will start using the new data source.

How to create environment variable –

Step 1:

Sign in to power automate and on left pane select solutions.

Power Automate – Create Solutions

Step 2:

Create the new solution

Click on New Solution

Power Automate – New Solution

Step 3:

In the solution option give –

Give the name of the solution and publisher of the solution and then click on create

Power Automate – Create Solutions

Click on created new solution

Step 4:

On the command bar, select New > More, and then select Environment variable.

Power Automate- Create Environment Variable

Step 5:

On the right pane, complete the information, and then select Save:

Display Name: Enter a name for the environment variable.

Name: The unique name is automatically generated from the Display name, but we can change it.

Data type: Select from Decimal numberTextJSONTwo optionsData source, or Secret.

Current Value. Also known as the value. This property is optional and is a part of the environment variable value table. When a value is present it will be used, even if a default value is also present. Remove the value from your solution if you don’t want to use it in the next environment. 

Default Value. This column is part of the environment variable definition table and is not required. The default value is used if there is no current value.

Power Automate – Create Environment Variable

In the above environment variable I select the data type as data source and connector SharePoint as I select SharePoint connector it will automatically connect to the SharePoint.

Then select parameter type is site for site Variable and then select the current site which we use for our Power Automate.

And then click on Save.

Step 6:

Same as the site variable I create one more variable for list which is store on that site.

Power Automate – Create two Environment Variable

How to use environment variable into Power Automate?

Step 1:

Create a flow into solution.

Click on New -> Automation ->cloud flow -> instant flow

Power Automate – Create A flow

Step 2:

Give name to flow and select how to trigger the flow and then click on create.

Power Automate – Flow Creation

Step 3:

Then select the desired environment variable.

Power Automate – Set Environment Variable

Step 4:

After adding environment variable save the flow and test the flow.

Power Automate – Run the created flow

Step 5:

Provide the initalizevariable_value as item id from the list.

Power Automate – Ran flow Successfully.

We can see the flow ran successfully.

Hope you understand about the Environment variable.

Thanks

Have a nice day:)

Shruti Wani

Microsoft365 developer at OS InfoTech.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: