Identify the nearest technician from an asset using Power automate

Steel Contributor

We have a SharePoint list which stores the Assets' locations (Latitude & Longitude).

When a support ticket is created for an asset >> Technicians will get an email that a support ticket was created for an asset >> so they need to login to Power Apps and send their location.

 

So at the end we will have 2 SharePoint lists; first one which stores the current technicians' Latitude and Longitude + second one which stores the related Asset Latitude and Longitude.

 

Then i want to trigger a workflow which calculate the nearest technician from the asset (nearest route using vehicle) and send him/her an email. so is this possible inside power automate to calculate the nearest route between 2 coordinations (The Asset coordination & The Technicians coordination) ?

13 Replies

Hi @john john,

your question is really interesting.

Here is just an idea how it could be done:

Prerequisites:

  • Power Automate account
  • External mapping service account (e.g., Azure Maps, Google Maps)
  • Two SharePoint lists:
    • One list to store the assets' locations (Latitude & Longitude)
    • One list to store the technicians' current locations (Latitude & Longitude)

Steps:

  1. Create a Power Automate flow that is triggered when a new item is created in the SharePoint list that contains the assets' locations.
  2. Use an HTTP action to call the external mapping service and pass the coordinates of the asset and the technicians' locations.
  3. Parse the response from the mapping service to identify the technician with the shortest distance or travel time to the asset. This technician is the nearest one.
  4. Send an email notification to the nearest technician, informing them of the support ticket and providing details on the asset's location.
  5. Optionally, update a SharePoint list or record associated with the support ticket to indicate that the nearest technician has been assigned.

More about the idea:

  • You can use the Azure Maps API or Google Maps API to calculate the nearest route and distance/time between the asset and each technician.
  • You will need an API key for authentication and usage limits may apply.
  • You can consult with your organization's IT or development team for any specific requirements or updates related to Power Automate and SharePoint.


Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)

@LeonPavesic thanks for the steps and reply.. but can you provide more specific reply... does the Bing Map connector which is offered by Power Automate, can solve this issue? 

Hi @john john,

thanks for your feedback.

The Bing Maps connector in Power Automate can indeed help you calculate distances and routes between coordinates, which could be useful for finding the nearest technician to an asset.

Bing Maps - Connectors | Microsoft Learn

To do that you can use following steps:

Step 1: Set Up Your Flow Trigger

  • Begin by creating a flow in Power Automate. Configure it to trigger whenever a new support ticket is created for an asset in your SharePoint list.

Step 2: Retrieve Asset Coordinates

  • Use the SharePoint connector in Power Automate to get the latitude and longitude of the asset from your SharePoint list.

Step 3: Fetch Technicians' Coordinates

  • Again, use the SharePoint connector to retrieve the latitude and longitude of all your technicians from the SharePoint list where their current locations are stored.

Step 4: Loop Through Technicians

  • In your flow, employ an "Apply to Each" control to cycle through each technician's coordinates.

Step 5: Calculate Distances

  • Within this loop, employ the Bing Maps connector to calculate the distance or travel time between the asset's coordinates and each technician's current coordinates. You can use the "Get Route" action for this calculation.

Step 6: Identify the Nearest Technician

  • As you go through the loop, keep track of the technician with the shortest distance or travel time. You can use variables or compose actions in Power Automate to store this information.

Step 7: Send Email to the Nearest Technician

  • Once the loop completes, you'll have determined the nearest technician. Send an email notification to this technician with all the necessary details regarding the support ticket and the location of the asset.

Step 8: Optional - Update SharePoint List

  • If needed, you can update a SharePoint list or a specific record associated with the support ticket to indicate that the nearest technician has been assigned.

I hope this helps you.

Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)

@LeonPavesic and is this BingMap connector which allow us to calculate the routes offered as a standard connector or premium connector

 

again i am asking very specific question i do not need all the steps you are providing,, your replies are similar to the ones i got using some AI tools.. i actually got a very similar reply when i used a popular AI tool !!

Hi @john john,

Bing Maps connector for Power Automate is a standard connector for Power Automate (the exception is China Cloud). You can check Microsoft Learn Documentation for more information.

LeonPavesic_0-1696830351486.png

Bing Maps - Connectors | Microsoft Learn

Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)

@LeonPavesic  and per your knowledge, does it allow us to calculate the nearest route between 2 coordinations ?

@john john rather than the  answers suggested previously I would do this in Power Apps as the Bing Maps connector works well with it. In Power Apps there is a BingMaps.GetRoute() function which will show you the route between 2 points. Note, it can't handle multiple points just a start and end. I built an app for my company using Bing Maps which doesn't in fact get the route but does calculate the distance between 2 points. The user manually enters the startand end locations but they could equally be selected from a SharePoint list using dropdowns.

 

MapperOct2023.png

 

Come back with questions if you need more info about how I did any of this.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)

Hi @john john,

thanks for your Update.

As far as I know, the Bing Maps connector in Power Automate primarily focuses on providing geo data and route calculation services, but it does not directly provide functionality to calculate the nearest route between two coordinates in the way you are looking for. 

You can take a look to this discussion regarding your question and GetRoute:
Solved: Re: BingMaps.GetRoute() - Power Platform Community (microsoft.com)


Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)

@Rob_Elliott  Thanks a lot for the reply... but why not to do the same inside Power automate ? as the Bing Map connector inside power automate provides the same features as in power apps? am I correct? I prefer to do the calculation inside Power Automate and have Power Apps display the results only which will be stored inside a SharePoint list

@john john because I wasn't asked to do it in Power Automate but to have an app that staff could use visually. It was just an example of Bing Maps being used in an app in a real world environment.

@LeonPavesic thanks for the reply, i only want Power automate to calculate the route distance between 2 points at a time.. and then i will display this value inside a list inside Power Apps... 

 

the list will show the technician name >> and the distance between the technician and the asset.. something as follow:-

 

Technican1   1km

Technicnai2   10 km

TechncianX      X km 

 

 

so i think Bing Map power automate will be sufficient for me,, am i correct?

@Rob_Elliott ok thanks, i thought you are saying that it will not be possible to do it in Power automate... as based on my info, Bing Map connector for Power automate and for Power Apps provides the same features

Hi @john john,

correct, using Bing Map in Power Automate will be more then sufficient for your needs.



Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)