cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Post Prodigy
Post Prodigy

Get name of environment that flow is running in

I have read this solution here:

https://powerusers.microsoft.com/t5/Building-Flows/Get-name-of-environment-that-flow-is-running-in/m...

 

DeepakS has provided a solution, but I cannot fathom what it means.

 

What is workflow() and how do I use it?

 

I do not see any information I can use at the link: https://docs.microsoft.com/en-us/connectors/powerplatformforadmins/#get-environment-as-admin

 

Can anyone provide me with more details?

 

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Super User
Super User

Hi @stapes ,

I think that your question should be posted on PowerAutomate community.

But, here is your answer: 

workflow() is a function in PowerAutomate, you should use it inside the Get Environment as Admin action. On Get Environment as Admin action environment please use Enter a custom value and then use the following formula to get your result:

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

 

See the picture: 

Capture.PNG

View solution in original post

12 REPLIES 12
gabibalaban
Super User
Super User

Hi @stapes ,

I think that your question should be posted on PowerAutomate community.

But, here is your answer: 

workflow() is a function in PowerAutomate, you should use it inside the Get Environment as Admin action. On Get Environment as Admin action environment please use Enter a custom value and then use the following formula to get your result:

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

 

See the picture: 

Capture.PNG

That's great @gabibalaban 

 

How can I get that data back to my app? I usually use a Request / Response in the Flow & a ClearCollect in the App.

Yes ... Use from PowerApps ->Action -> PowerAutomate and create a flow triggered by PowerApps. 

Use as last action in PowerAutomate the action Respond to PowerApps ( and set the data you need that PowerAutomate to respond to PowerApps).

@gabibalaban 

I can't seem to make that work.

All I am getting back in my App is a Boolean 'True' value:

Set(gblEnvironmentVariable,'PowerApp->GetEnvironmentasAdmin'.Run());

get environment as admin.PNG 

You mean that when you use 

gblEnvironmentVariable.DisplayName

you didn't get the desired result ? 

 

If no, please go to PowerAutomate and check the succesfullines of the flow. 

@gabibalaban 

I think my flow is working, but no data is being returned to my app!

 

respond.PNGgblEnvironmentVariable.PNG

 

To check the issue please set :

Set(gblEnvironmentVariable,'PowerApp->GetEnvironmentasAdmin'.Run().displayname);

 this it should set gblEnvironmentVariable only with the displayname received from PowerAutomate.

Is there any possibility to set/use gblEnvironmentVariable in other place of the app ? 

@gabibalaban 

 

It does not allow Set(gblEnvironmentName,'PowerApp->GetEnvironmentasAdmin'.Run().DisplayName)

 

I get Invalid use of '.'

It seems that is a problem I cannot identify. Please find attach a demoapp which include all your request. It worked fine on my side. 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,222)