Updated: Jun 30
Well this is a pretty catchy title isn't it, but then I couldn't really shorten it. This is an intermediate level post and is going to be about how to use the following functions and triggers in Flow:
1. The "When I enter or exit an area" trigger
2. Object variable
3. Compose data action
Don’t let the fact I’ve said it’s an intermediate post scare you. If I can get this, then I am sure you can too.
You need the Flow app from the iOS or Google Play store. When you have this installed you need to make sure you are logged into your Flow account on the mobile app and ensure location based services are turned on to Always for the application in your phone settings. I missed this bit out and I could never get the location based trigger to work, and to be honest it's a bit of a numpty move. I mean of course it needs the app and the Always on location based services on.
Anyway ! Lets crack on with this bad boy.
Nuance number 2
To get the “when I enter or exit an area” trigger, isn't straight forward. Because this action is in preview mode at the moment, you need to do the following:
1. Create a new Automated from blank flow
2. Choose any trigger, and click create
3. Delete that trigger
4. Then search for "When I enter or exit an area"
And we continue....
So now we are cooking !
Click on the Create Trigger Region button and select your area. I think this is based on Bing maps, so can be a bit tricky as sometimes it's hard to see where you are on the map and to pinpoint an exit or entry point. But you get the general idea.
We next need to initialise a variable, it needs to be an Object type and capture the BODY response from the initial when I enter or exit trigger, like this:
Then we need to use the Compose Data Operations action. This will help us compose the component of the JSON that we need later on in our condition. We do this because we need to pull out a particular JSON value from the BODY object.
If we look at the output of the Initialise action after the Flow has run:
What we are looking for is the transitionType part of the JSON response. There are two results to this variable 1 or 2.
If it returns a 1 it means we have entered the area.
If it returns a 2 it means that we have exited the area.
Back to the Flow creation. We now need a Compose action. What we need to do, is extract the transitionType JSON object from the object variable output ExitEntryJSON (Which in turn contains the BODY response of the “When I enter or exit an area” trigger) that we named earlier, copy and paste the below for that if you are using the same naming conventions as I have done.
Are you still following ? If not. Take a few steps back and have another read. When I am learning I do this all the time. Reading slowly helps and you won’t miss a step.
The Compose action should look like something below:
Once you have done that, you can now use the Output dynamic content from the Compose action to base your condition on whether the transitionType is equal to 1 or 2 as we discussed above.
Then you can start sending notifications or emails or whatever you want to do based on whether you are leaving or entering the area.
Thanks for bearing with me. I am on a Flow journey as well and this is some of the more eye opening stuff I have done in this area.
Like I said at the top, if I can do it then anyone can. You’ve just got to have some belief in your skills.
As always, reach out if you have any questions or queries, always happy to help. I hope this helped you.
Speak again next time.