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
- Enable Click Scripts (please see this guide)
- Go to Main Menu > Admin > Development > App Builder and click on +App
- Name the app and select which roles who shall have access to this functionality. Click Save
-
Click on +Click Script,
- Name it accordingly, i.e. Open in Google Maps. This name will be visible when you right-click on a device.
- Select UserRightClickMenu as Kind.
- 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");
- 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:
- Enable Vehicle Status Pop-over, see guide.
- Go to Main Menu > Admin > Vehicle Status Templates
-
Create a new template
- Name it accordingly
- Add wanted widgets
-
Add Action Button
- Under Action, find your script created in the first part of this guide (i.e. Open in Google Maps)
- Choose an icon, this will be displayed on the pop-over
- Click OK
- Click Save
- Edit a user or batch edit multiple users to assign the template to them