Scripting for map pages

In the Script field on the Map Page form, you can use the available attributes or custom code to define map characteristics, such as marker appearance for items on the map, what information to display when someone clicks a marker, and more.

You can use the isMobile variable to set custom behavior for the smartphone view of the map.

To create an item on the map, use the map.addItem(glideRecord) method. You must pass a valid GlideRecord to addItem().

The following attributes are available.

Table 1. Scripting map item attributes
Attribute Description
name Name used for identification.
latitude Latitude is not necessary if you define an address.
longitude Longitude is not necessary if you define an address.
icon URL of the icon to display for the marker. The default Google marker is used if a custom icon is not specified.
icon_width Width of the icon. The default is 32.
icon_height Height of the icon. The default is 32.
table_name Table whose records display when the marker icon is clicked. Used in conjunction with the sys_id attribute.
sys_id Sys_id of the record that will display when the marker icon is clicked. Used in conjunction with the table_name attribute.
view View of the form displayed in the dialog box when the marker icon is clicked.
dialog_title Title of the dialog box containing the record information.
html Arbitrary HTML code for the pop-up window. If used, this value overrides the dialog box.
marker_label Optional marker icon label text. For an example, see Map page marker label script.
label_offset_left Optional attribute that is used with marker_label to define the horizontal position of the marker label. The default is 0.
label_offset_top Optional attribute that is used with marker_label to define the vertical position of the marker label. The default is 0.