You can use the workflow() expression in Power Automate to get environment, flow, and run information directly in your flow. This can be useful for tasks like sending error messages, automating restarts of expired flows, or differentiating between DEV and PROD environments. The workflow() expression provides values such as environment id, workflow id, workflow name, and run id. You can use expressions to extract these values from the output JSON. However, to get the environment name, you'll need to use the "List my Environments" action and filter the array to get the current environment's display name. By getting this information directly from the flow, you can avoid hard coding values or manually updating environment variables.
Login now to access my digest by 365.Training