Enhancing the Area-trigger in Flow

At the time of writing this post, there’s a preview trigger in Power Automate for when you enter or leave an area.

For this trigger to work, you need to install the Power Automate app in your mobile phone and also allow it to always track your location.
Power Automate for IOS
Power Automate for Andorid

It’s actually super easy to set up the trigger. You get this map and simply drag around until the circle covers the area you want. Zoom to make the circle bigger or smaller.
In this case, I’ve covered the central train station of Stockholm.

The problem with this is that it currently isn’t a built in control to decide if you entered the area or exited the area. Let’s say you want to inform your partner when you’re driving past a specific point on your way home from work. You probably don’t want two messages for the same thing (one when you enter the area and then again when you leave it).

To solve this, set your next step as “Parse JSON” in your flow.

{
    "type": "object",
    "properties": {
        "currentLatitude": {
            "type": "string"
        },
        "radius": {
            "type": "integer"
        },
        "transitionType": {
            "type": "integer"
        },
        "currentLongitude": {
            "type": "string"
        }
    }
}

The important thing here is that we’ll get the TransitionType as a dynamic value to use later on in our flow.
When I’m writing this blog post there are 2 possible values:
1 = Entering the Area
2 = Leaving the Area

You can therefor use this Condition to decide what will happen when you Enter an area (Yes) or when you Exit the Area (No).

All in all, this is what my entire Flow looks like. As you can see, I’m using this the send two different kind of emails when entering or exiting the area.

Add a Comment

Your email address will not be published.