Configuring Map Pin Tooltips
On the Map, you can configure the text that appears in Map Pin tooltips related to Job, Resource, and Crew records. To do so, you configure Tooltip Definition records, define code to automatically generate information when users move their mouse pointers over a Job Pin, Resource Pin, or Crew Pin, and then configure key-value pairs in the Tooltip Settings record.
* 
If no valid Tooltip Definition is configured for Map Pins, tooltip content defaults to the standard format that ships with Service Board.
To configure Map tooltips:
1. Follow the steps in Configuring Tooltip Definitions to create a Tooltip Definition record, and in the Related Object field, do one of the following:
To configure a Job Pin tooltip, select the Job object.
To configure a Resource Pin tooltip, select the Resource object.
To configure a Crew Pin tooltip, select the Crew object.
2. In the Code field, implement Groovy code to define the tooltip content as shown in the following examples:
To configure a Job Pin tooltip that shows the job name and related account name in two lines with the account name in bold font:
jobName = com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml(entity.primaryName, 100)
accountName = svmx_account?.entity?.primaryName ?:
account = com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml(accountName, 100)

"$<span>{jobName}</span><br /><b>${account}</b>"
* 
Job names and account names are truncated if longer than 100 characters.
To configure a Resource Pin tooltip that shows the resource name and translated resource type in two lines, with the resource name in bold font:
resourceName = com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml(entity.primaryName, 100)
// translate the resource type name
resourceTypeName = com.intalio.core.translation.TranslationFactory.getTranslatedMetadata('io_option', svmx_resource_type[0].getRecordId(), 'io_name')
resourceType = com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml(resourceTypeName, 100)

"<b>${resourceName}</b><br/><span>${resourceType}</span>"
* 
Resource names and types are truncated if longer than 100 characters.
To configure a Crew Pin that shows only the primary crew name:
crewName = com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml(entity.primaryName, 100)

"<span>${crewName}</span>"
* 
Crew names longer than 100 characters are truncated.
Useful APIs
API
Description
Example
truncateAndEscapeHtml
Truncate text strings longer than the specified value and escape HTML tags.
com.servicemax.dc.util.CommonUtils.truncateAndEscapeHtml('This is a long text with tags.', 32)
Returns This is a long text with <html...
getTranslatedMetadata
Translate records to the current user’s default language.
technicianTypeId = UUID.fromString('c0728765-a8f4-49d9-acd2-79cb71a8dc0e')com.intalio.core.translation.TranslationFactory.getTranslatedMetadata('io_option', technicianTypeId, 'io_name')
Returns resource type translations in the current user’s default language.
3. Follow the steps in Configuring Tooltip Settings to configure key-value pairs for the new Tooltip Definition record in the Tooltip Setting setting with the following keys, as applicable:
Job Pin tooltip: svmx_job::map_pin_tooltip
Resource Pin tooltip: svmx_resource::map_pin_tooltip
Crew Pin tooltip: svmx_crew::map_pin_tooltip
Was this helpful?