Coffee Flow in progress

Finally it is in preview, the geo-fence trigger in Microsoft Flow. I have been waiting for that feature for some time. I am also glad for the heads-up from Rebekka who spotted this feature in the wild!

I am nearby the Office get me some coffee

Of course this idea is not new. Jon Levesque created a nice video about this idea.

I want to take it a step further though. I wanted to connect it with Dynamics 365 CRM to get the actually coffee preference of the nearby user. This Flow will also post a message on a Microsoft Teams channel.

Coffee request message

The Flow

The flow only has four steps. The first step is of course the new geo-fence trigger. I am also using a variable for the user principal name (UPN) of the flow user. This UPN is used as a filter to get the coffee preference of the user in Dynamics 365 by using a get contact record action. The last step is to post a message on a Teams channel.

Coffee Flow

Geo-fence trigger

With this new trigger it is possible to start of a Flow when you enter or exit a specific area.

When I enter or exit an area

The area can be selected by searching for an address or by entering the coordinates manually. By zooming in and out you can make the area (geo-fence) smaller or larger. The area in the current version is always a circle.

Trigger region

User principal name variable

The next action is a hard coded one. I am still figuring out if you can get the user principal name of the account that is running the Flow dynamically. I am just entering the email address of the user I want to get the coffee preference for.

Initialize variable UPN

Get contact record

This action will get the contact record for the earlier mentioned UPN. The flow uses the emailaddress1 attribute of the contact entity to filter for the specific contact record.

Get contact record

Customize the contact entity

The contact entity doens’t have a coffee preference field by default. These are the steps to create it via customizations in Dynamics 365.

1. Create a new field called coffee preference

You can add a new field by going to the customizations. Select the customize the system option.

Customize the system

Search for the contact entity and select the fields and click the new button.

New field contact entity

Create the new coffee preference field.

Coffee preference field

I used the option set data type and added some example values like espresso and flat white.

Coffee preference field data type

2. Show the new field on a form

Search for the contact entity and select forms and select one of the existing ones or create a new form.

Update contact form

Add the new coffee preference field and publish the form.

Add coffee preference field to form

And lastly, don’t forget to publish all your customizations.

Publish all customizations

Post a coffee request on teams

The last action will use the coffee preference and will post a message on a specific Microsoft Teams channel. The body of this message uses two expressions for getting the full name and the coffee preference values.

Post coffee message request

Testing is fun

Of course the testing was fun, running around the office. It works pretty well. But although I like the exercise I am missing a test flow option for this trigger.

I want to be able to manually add some coordinates for a test. I actually added a flow idea on the Power Users Flow community. So feel free to vote it up 😉

You may also like...

1 Response

  1. Chuck Steel says:

    I haven’t been able to get the trigger working. The limited documentation implies that the Flow app needs to be running on the device, but even with that running my flow has never been triggered. Do you have any thoughts on why that might be?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.