cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stapes
Impactful Individual
Impactful Individual

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
Dual Super User
Dual 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
Dual Super User
Dual 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

stapes
Impactful Individual
Impactful Individual

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).

stapes
Impactful Individual
Impactful Individual

@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. 

stapes
Impactful Individual
Impactful Individual

@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 ? 

stapes
Impactful Individual
Impactful Individual

@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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Top Solution Authors
Top Kudoed Authors
Users online (3,688)