So you start using environments and you deploy the app across multiple environment. How do users know which environment they are in?
There are two easy options to get the environment name while running an app.
The first option is easy, just set a text environment variable to the right value and your done. But this is something that needs to be done and could potentially go wrong if you forget to set the environment name.
The flow that we need to create has just 4 steps.
As we will be calling this flow form an app, there will be the Power Apps trigger. You can use either version 1 or version 2.
Then we will use the List My Environment step. This step will get all the environment details in your tenant.
As there are no filter options on the Get my environment action, we will need to use a Filter Array action to get the current environment.
We will need a couple of expressions here:
From: outputs(‘List_My_Environments’)?[‘body/value’]
Left: item()[‘name’]
Operation: is equal to
Right: workflow().tags.environmentName
The above details will take the list of environments and return just the one environment that is recognised by the workflow function as the current environment.
Then the respond to a Power app action will nbeed the following expression to get the name of the envrionmment:
first(body('Filter_array')).properties.displayName
We now haver the name of the environment as a simple text ready to be returned to the app.
All we now have to do is update the app to show us the display name of the environment:
@first(body('Filter_array')).properties.displayName
Continue Reading Pieter Veenstra’s Article on their blog
Display the environment name in your Canvas App in Power Apps
There are two easy options to get the environment name while running an app.
Blog Syndicated with Pieter Veenstra’s Permission