Forum Discussion

john john's avatar
john john
Steel Contributor
Oct 04, 2023

Identify the nearest technician from an asset using Power automate

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) ?

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    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)

    • john john's avatar
      john john
      Steel Contributor

      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? 

      • LeonPavesic's avatar
        LeonPavesic
        Silver Contributor

        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)

Resources