Power Automate: Find the current environment

When working with an ATOP setup you might need to know in which environment the Power Automate flow is running. For my solution I needed to know the environment because each environment uses a different Gateway and database credentials. In this post, I will share with you how to find the environment GUID and name.

Creating the flow

  • Create a flow and use the trigger Manually trigger a flow.
  • Add the action Get Environments under Power Apps for Makers
  • Add the Compose action and use the Workflow() expression, to get the current instance of the flow.
  • Parse the Output in a Parse JSON action.
  • Initialize a variable with the name environment as a string.
  • The Value is the EnvironmentName form the Parse JSON output.
  • Now you have the GUID of the current Environment in the variable.
  • To find the name of the current environment we need to go through the results of the Get Environments action.
  • Add a Condition control action and check if the environment variable is equal to the name from the Get Environments actions.
  • This will automatically add an Apply to each, this is because the Get Environments action might return more than one environment.
  • Add a Set variable action in the If yes section and set the variable environment to displayName.
  • Now you have the Name of the current Environment in the variable.
  • The final step is to add a Switch control and switch based on the name of the current environment.
  • The flow will now look like this.

Power Automate: 6 flow building tips

Power Automate is one of my favorite tools from the Power Platform. It is extremely versatile and can be used to automate tasks between online services and automate processes ranging from simple to highly complex. In this post, I will share with you 6 tips and tricks when building flows in Power Automate.

Flow templates

A good way to get started with Power Automate is to use a template. Microsoft created a huge library of templates to choose from. You can browse by category to find your scenario, and then follow the steps in the template to create a flow from the template. You can also us the templates to figure out how to setup certain actions.

Equal to empty

Over the years many colleagues have asked me; how do I check if a value is empty? You can do this with the null expression! Note that sometimes you need to place the null between ‘ ‘.

Use parallel branches

Most flow builders forget to use the parallel branches. With parallel branches you can have two or more actions that run at the same time, after which the flow will only proceed once all parallel steps have completed. Parallel branches can be very useful for approval flows. For example, you have a request that needs to be approved by both IT and Sales, but the approval doesn’t need to be in a particular order. To save time you can run the approvals parallel.

Use scopes

We can use the action scope to group actions to make the flow easier to read. There is however another great use for them. The scope action encapsulates a block of actions and inherit the last terminal status (Succeeded, Failed, Cancelled) of actions inside. This in combination with the Configure run after setting we can create a try and catch logic in our flows. In this example the second scope (catch) only runs if the first scope (Try) failed.

  • Create a scope with some actions
  • Create a second scope after the first scope
  • Set the Configure run after setting of the second scope to has failed, is skipped and has timed out.
  • In this scenario the catch scope will only run if the Try scoped failed.
  • The flow will look like this.

Add redundant owners

If you have a flow that is used by your entire team, make sure you add a couple of co-owners. Then you will not be bothered during your vacation when the flow breaks. If you keep adding the same colleaguesas co-owners you can consider creating a security group and add the security group to the flows. Also make sure you add the co-owners to all the resources required by the flow. For example, the shared mailed that is used by the flow.


Actions use by default the connection (if required) of the creator of the flow. This is not always the best way to setup the connections. For example, if your flow updates a list you might not want to see your name as the modifier. I recommend using a dedicated account (service account) for most shared flows. The added benefit of using a dedicated account is that the flow will keep working even if you change your job.

Power Automate: Start a Flow from a column change

With Microsoft Power Automate we can now create flows that start based on specific columns being updated in SharePoint!  This is a feature I have been waiting on for years! The action is called Get changes for an item or a file. The action returns a boolean for each field, whether it was just changed or not. Based on this boolean you know if a field was changed.

Creating the flow

  • Create a SharePoint list, I created the following project list.
  • Enable versioning on the list.
  • Create a flow and use the trigger When an item or a file is modified.
  • Select your site and list.
  • Add the action Get changes for an item or a file (properties only).
  • Fill in the site address, library name and the ID of the item that was triggered.
  • The field Since is used to get the changes we need to make a comparison. If you use 1.0 you will compare the current item version with version 1.0. But we want the latest changes so we use the following expression.
  • I want to send an email when the end date of a project changes.
  • Add the action Conditions to check if the end date was changed.
  • Add the dynamic content Has Column Changed: End date.
    This returns a boolean value.
  • Put the required actions in the If yes section after the condition.
    In my example I am sending an email.
  • Add the action Send an email (V2) and fill in as follows.

Power Automate: Creating and updating a document set in SharePoint

Many colleagues have asked me how to create or update document sets with Power Automate. I had never done this before so I told them to use a web service. From now on, I can point them to this blog post. The flow is created with the help of my colleague Jasper Voskuilen, because this web service is a bit more complicated to setup.

Creating the flow

  • Open Power Automate and create a new flow (automation).
  • I created a flow with the trigger, for a selected item.
  • In my situation I get all items from a list and then create a document set for each result.
  • Create the following variables with the related values.
  • This will make the flow more dynamic for later changes.
  • SiteURL as a string, fill in the Site URL.
  • ContentType as a string, fill in the content type id.
  • URLLibrary as a string, fill in the library name part of the ULR.
    For this example it is: Library
  • TitleLibrary as a string, fill in the title (name) of the library.
  • WebServiceURLBibliotheek as a string, fill in the Library URL used by the web service.
  • You can find the web service url by using the following URL
  • Add the action Send an HTTP request to SharePoint
  • Use the varibles to configure the web service.
  • The name of the document set needs to be unique. I used a value from my list item, your situation might be different.
  • If required you can update the newly created document set.
  • Add the action Parse JSON and parse the Body of the Create Document set HTTP request.
  • Add the action Send an HTTP request to SharePoint
  • Use the variables to configure the web service.
  • The properties you need to set might be different than mine. I used values from my list item but your situation might be different.

Flow: Button to launch a Flow/Automate from a view

You can use column formatting (JSON) to create buttons that start a Flow on the corresponding list item in SharePoint. The button will be shown in the view for easy and fast access. After clicking the button the Flow Launch Panel will be displayed and you can start the Flow. This button is faster then clicking on the … then Flows followed by clicking the correct Flow.

Creating the button

  • Open the settings of the document library.
  • Create a new single line of text column with the name Start a Automate.
  • Go to a view where the new column is visible.
  • Open the menu of the column, click on Columns settings followed by Format this column.
  • If required click on the advanced mode option.
  • Copy and change the code below.
  • Change the txtContent to the name that needs to displayed as the value of the column. Currently it is Start the Automate.
  • Change the actionParams id to the Power Automate ID, see the steps below.
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"788b1689-e999-99d9-9f37-fc539d5ba36b\"}"
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  "children": [
      "elmType": "span",
      "attributes": {
        "iconName": "Flow"
      "style": {
        "padding-right": "6px"
      "elmType": "span",
      "txtContent": "Start the Automate"
  • Add the JSON code and save the changes.
  • The button can only start Power Automate from the default environment.

Finding the Automate ID

  • Open Power Automate.
  • Click on the name of the Automate.
  • In the ID is located in the URL after shared.
  • For the following Flow URL the ID is 788b1689-e999-99d9-9f37-fc539d5ba36b
  • The button can only start Automates form the default environment.