Click Script: Open position in Google Maps using right-click or via Vehicle Status pop-over

Click scripts can be used to display the location of a device on a external map service. In this example, we are using Google Maps.

Create click script

  1. Enable Click Scripts (please see this guide)
  2. Go to Main Menu > Admin > Development > App Builder and click on +App
  3. Name the app and select which roles who shall have access to this functionality. Click Save
  4. Click on +Click Script,
    1. Name it accordingly, i.e. Open in Google Maps. This name will be visible when you right-click on a device.
    2. Select UserRightClickMenu as Kind.
    3. Click on Edit and past the following script:
var latitude = user.trackPoint.position.latitude;
var longitude = user.trackPoint.position.longitude;
var url = 'https://www.google.com/maps/search/?api=1&query='+latitude+'%2C'+longitude;
ui.open(url);
log("OK");

  1. Close the window.

Button on vehicle status pop-over

If you want to add a button on the vehicle status pop-over (see here), do as follows:

  1. Enable Vehicle Status Pop-over, see guide.
  2. Go to Main Menu > Admin > Vehicle Status Templates
  3. Create a new template
    1. Name it accordingly
    2. Add wanted widgets
    3. Add Action Button
      1. Under Action, find your script created in the first part of this guide (i.e. Open in Google Maps)
      2. Choose an icon, this will be displayed on the pop-over
      3. Click OK
      4. Click Save
  4. Edit a user or batch edit multiple users to assign the template to them