Sep 21, 2023

Check current environment inside Flow

It can be useful to understand what environment flow is running on. This enables us perform separate action or use separate values based on the environment. Lets see how to do that.

Component we use here is Get Environment as Admin of Power Platform for Admins.


This lists down available environments along with option to give custom value which we select here. 


Then we need to select below formula.

workflow()['tags']['environmentName']


When we do any action, now we are allowed to select Display Name from same component and it will return the respective environment name.


We can use Compose component to check if you get the Environment name correctly.


Usually we use IF condition to perform separate action or use separate values by environment. In below example, IF condition is used to set company Email address only if the Environment is UAT otherwise use personal Email address.
 
if(equals(outputs('Get Environement as Admin')?['body/properties/displayName'],'UAT'),'info@abc.com','sumedha@abc.com')

Hope this helps.