Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

isMobile map page script

Log in to subscribe to topics and get notified when content changes.

isMobile map page script

This script is used to display all active, critical incident locations with custom settings for smartphone users.

//setup new GlideRecord query on the incident table
var gr = new GlideRecord("incident");
//add condition for priority 1
gr.addQuery('priority', '1');
//add condition for active incidents
gr.addActiveQuery();
//execute the query
gr.query();
 
//loop through the list of incidents returned by the query
while (gr.next()) {
 
 //create a new map item to display - linked to the current incident record
 var item = map.addItem(gr);
 //add the latitude value from the incident's location
 item.latitude = gr.location.latitude;
 //add the longitude value from the incident's location
 item.longitude = gr.location.longitude;
 //add the incident number to the dialog title
 item.dialog_title = gr.getDisplayValue();
 //link to the icon image
 item.icon = "http://maps.google.com/mapfiles/kml/pal3/icon51.png";
 
 //set the icon size (use smaller icons for smartphone users)
 if (isMobile) {
   item.icon_width = "12";
   item.icon_height = "12";
 }
 else { 
   item.icon_width = "16";
   item.icon_height = "16";
 }
}
Feedback