cancel
Showing results for 
Search instead for 
Did you mean: 

Get environment ID within Flow or app

Can we have a way to determine the environment ID that a flow or app is currently running in?

 

I have several flows and apps that I develop in a staging environment, test using test data, and then promote to a production environment, which run on production data. It would be nice to be able to determine which environment the flow/app is running in, and do branching conditions based on that. For example:

 

* My canvas app allows people to send emails to another person. In staging, I want those emails to always go to a hard-coded email address (the person who is testing). In production, I want the emails to go to the actual recipient.

* Same as above, but it is in a flow.

* One of my flows creates a record and assigns it to a specific owner. The owner exists in the production environment, but not in the staging environment, because he isn't part of the group that tests things. I have to change which user the record gets assigned to based on which environment the flow is running in.

 

Currently I'm solving this by exporting the flow/app from staging, importing it into prod, and going in to make all of the manual tweaks to the logic. This process is highly prone to errors, because I may forget to do one of the tweaks, and if anybody else makes changes, we might now know what tweaks need to be made in each other's code. This would be much easier with conditional logic based on the environment ID.

Status: New
Comments
Level: Powered On

I think environment variables solve this for me: https://powerapps.microsoft.com/en-us/blog/environment-variables-available-in-preview/

 

Thanks, Microsoft!