web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get name of environmen...
Power Apps
Unanswered

Get name of environment that flow is running in

(0) ShareShare
ReportReport
Posted on by 894

I have read this solution here:

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

 

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?

 

Categories:
I have the same question (0)
  • Verified answer
    CU-18081211-6 Profile Picture
    9,270 Moderator on at

    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 Profile Picture
    894 on at

    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.

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    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 Profile Picture
    894 on at

    @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 

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    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 Profile Picture
    894 on at

    @gabibalaban 

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

     

    respond.PNGgblEnvironmentVariable.PNG

     

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    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 Profile Picture
    894 on at

    @gabibalaban 

     

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

     

    I get Invalid use of '.'

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    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. 

  • stapes Profile Picture
    894 on at

    Thanks @gabibalaban - that definitely works.

     

    What does it use Outlook for? It asked for permission to use Outlook.

     

    Like you, I can see no reason why yours works & mine doesn't.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard