Advanced | Flow of The Week: Record your travel mileage using Flow and Bing Maps
Whats up Flow Fans?!
This weeks Flow of the week is written by Flow & PowerApps MVP Daniel Christian. Daniel is a rockstar community member, Lego superstar and all around problem solver 101. Check out his YouTube Channel and follow him on Twitter HERE. Also, be sure to leave some questions or comments below and he will be happy to answer them!
Recording your travel mileage is a crucial and currently a manual process to get travel reimbursement, however, now thanks to Flow and the Bing Maps connector we can automate this process as well. There are two Flows, one is for departures and the second for arrival but both of them update the single row in the Excel spreadsheet. The Flow is smart enough to see which was the last entry submitted by the user that only has the departure information and is pending arrival.
1. A Flow subscription
2. A Bing Maps Key
3. A location to save the date. In this scenario we are using Excel saved in OneDrive but you can do the same using SharePoint lists, Common Data Services Entity or SQL tables.
Bing Maps Connector:
You need to first create an account with Bing Maps Portal at https://www.bingmapsportal.com/ using an existing Microsoft account. You can then select the My Keys option in My account drop-down list.
Next head over to https://Flow.Microsoft.com to add the Bing Maps connector which is currently in preview.
The Excel spreadsheet is located in the OneDrive for Business and is shared with all the users who are using this Flow.
Flow #1: Depart
This flow uses a virtual button to trigger. Here is what the Flow looks like.
Flow #2: Arrive
When the flow is triggered, we first create two variables, one is to save the email address of the user provided by the Flow button action, the other is where the distance is going to be saved. The FlowUserVar is required for a condition to work.
This video demonstrates how the two Flow virtual buttons work and the logic behind the flow.
The total mileage is presented by Bing Maps and might have subtle differences if compared to other maps such as Google. Also, in this case I have only recorded the mileage but you could record the total time it took by calculating the delta between the start and end time.