Customizing Notification Message Templates
Message templates are blocks of Groovy code that you can implement in specific objects to define custom notification messages. You can customize message templates for the following objects and fields.
Object
Fields
Email Notification Request
From
To
Cc
Bcc
Reply To
Subject
Body
Phone Notification Request
Create Message Template
Update Message Template
Delete Message Template
HTTP Notification Request
URL
Push Notification Request
Message
Message templates can be simple as plain-text strings, or as complex as logic that includes a variety of variables to generate dynamic messages based on the records that trigger notifications. Plain text does not include any variables, for example, High-Priority Job Created. Complex templates can include a mixture of text and built-in variables that are injected during execution, which must be enclosed in ${ and }, for example, ${ svmx_name } must be dispatched immediately. The following built-in variables are available for use in message templates.
Variable
Usage
Examples
ctx
Used with the the io_instance_url and io_instance_url_without_scheme properties.
${ ctx.io_instance_url }
${ ctx.io_instance_url_without_scheme }
json
Used to parse a string as a JSON object, or to convert Java objects such as maps to JSON strings.
If svmx_message contains the JSON string ${ json.parse(svmx_message) }, map is the Java Map instance ${ json.toJson(map) }, and a Push Notification Request uses the translation svmx_dc_gtt_sfdc_to_sb_sync_error_title and the field io_salesforce_to_service_board_sync_errors:
${ json.toJson([title: i18n.svmx_dc_gtt_sfdc_to_sb_sync_error_title,messageDetailList:json.parse(io_salesforce_to_service_board_sync_errors).values()])}
i18n
Used to define message translations in Max.
Translation without parameter:
${ i18n.io_servicemax }
Translation with parameter:
${ i18n.io_updated_with_parameter('Job') }
ops
Used to call operations in Max.
Operation without parameter:
${ i18n.io_get_user_language }
Operation with parameter:
${ ops.svmx_format_technician_data(['record': record, 'field': 'svmx_start_datetime']) }
Example HTTP Notification Request:
${ ops.svmx_get_integration_instance_url}/services/apexrest/${ops.svmx_get_sb_url_name_space}integration/v1/txdata${ ops.svmx_get_integration_instance_url + data.url }
record
Used to access the record that triggers the notification.
* 
Typically, you can directly access fields by full identifiers, for example, io_name.Use the record.getFieldValue method only when necessary.
Get field value:
${ record.getFieldValue('io_active') }
[Field Full Identifier] and [Shortcut Variables]
Use full identifiers to retrieve field values from records that trigger notifications.
Related shortcut variables:
id: UUID of a record
name: Primary name of a record
_ob_uuid: UUID of an object related to a record
_ob_name: Name of an object related to a record
_ob_identifier: Full identifer of an object related to a record
Field variables for a record that triggers a notification:
${ io_name }
${ io_priority }
Shortcut variables for a record that triggers a notification:
${ id }
${ name }
${ _ob_uuid }
${ _ob_name }
${ _ob_identifier }
Shortcut variables for a Dynamic/Relationship field:
${ io_related_record.id }
${ io_related_record.name }
${ io_related_record._ob_uuid }
${ io_related_record._ob_name }
${ io_related_record._ob_identifier }
In cases where related records are deleted, use read() to load records and access fields as follows:
${ io_related_record.read(); io_related_record } has been deleted by ${ io_related_record.io_updated_by }.
* 
If you use record.io_name, an error is triggered. Instead, access the field directly by its full identifer (io_name).
If your existing message template logic is written in Ruby, you must migrate to Groovy as shown in the following examples.
Language
Templates
Phone Notification Request: Create Appointment, Update Appointment, Delete Appointment
Ruby
New Appointment (<%= record.svmx_name %>)
Groovy
New Appointment (${ svmx_name })
With more information:
New Appointment (${ svmx_name })
Start Date/Time: (${ ops.svmx_format_technician_data(['record': record, 'field': 'svmx_start_datetime']) })
End Date/Time: (${ ops.svmx_format_technician_data(['record': record, 'field': 'svmx_end_datetime']) })
Push Notification Request: High-Priority Job Created
Ruby
"[svmx_job](<%= svmx_name %>)" must be dispatched immediately.
Groovy
"[svmx_job](${ svmx_name })" must be dispatched immediately.
Push Notification Request: Salesforce-to-Service-Board-Sync Errors
Ruby
{"title": "<%= ::Io::Translate.svmx_dc_gtt_sfdc_to_sb_sync_error_title %>", "messageDetailList": <%= JSON.parse(io_salesforce_to_service_board_sync_errors).map { |k, v| v} %>}
Groovy
${ json.toJson([title: i18n.svmx_dc_gtt_sfdc_to_sb_sync_error_title, messageDetailList:json.parse(io_salesforce_to_service_board_sync_errors).values()])}
Push Notification Request: Salesforce Validation Error
Ruby
<% record.getRelatedEntities('io_http_notification_related_record', true, {'ignore_delete' => true}) %> Search and update <%= record.io_related_record.getDefinition().getName() %> "[<%= record.io_related_record.getDefinition().getFullIdentifier() %>](<%= record.io_related_record.primaryName %> | <%=record.io_related_record.id %>)" to retry.
Groovy
${ io_related_record.read()}Search and update ${ io_related_record._ob_name } "[${ io_related_record._ob_identifier }](${ io_related_record } | ${io_related_record.id})" to retry.
Push Notification Request: Create Appointment Blocked by Pending Notification for Deletion Error
Ruby
<%= record.io_related_record.getDefinition().getName() %> "[<%= record.io_related_record.getDefinition().getFullIdentifier() %>](<%= record.io_related_record.primaryName %> | <%=record.io_related_record.id %>)" was not synced to Salesforce. The related job has a deleted appointment<% matcher = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i; result = record.io_not_ready_to_send_message.scan(matcher); %> (record ID: <%= result[0] %>) which failed to be synchronized to Salesforce. Contact your system administrator.
Groovy
${ io_related_record._ob_name } "[${ io_related_record._ob_identifier }](${ io_related_record } | ${ io_related_record.id })" was not synced to Salesforce. The related job has a deleted appointment (record ID: ${ matcher = (io_not_ready_to_send_message =~ /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/); matcher.find() ? matcher[0] : '-' }) which failed to be synchronized to Salesforce. Contact your system administrator.
HTTP Notification Request
Ruby
<%=::Io::Intalio.svmx_get_integration_instance_url%>/services/apexrest/<%=::Io::Intalio.svmx_get_sb_url_name_space%>integration/v1/txdata
Groovy
${ ops.svmx_get_integration_instance_url}/services/apexrest/${ops.svmx_get_sb_url_name_space}integration/v1/txdata
Ruby
<%=::Io::Intalio.svmx_get_integration_instance_url + data.url %>
Groovy
${ ops.svmx_get_integration_instance_url + data.url }
Email Notification Request: Error Syncing to Salesforce
Ruby
<%
instance_url = EntityRootDefinitionSingleton.getInstance().getSystemSettings().getSystemSettingValue('io_instance_url')
scheme_regex = /[a-zA-Z]([a-zA-Z]|\d|\+|\-|\.)*:\/\//
instance_url_without_scheme = instance_url.sub(scheme_regex, '')
%>
Error Syncing to Salesforce from Service Board (<%= instance_url_without_scheme %>)
Groovy
Error Syncing to Salesforce from Service Board (${ ctx.io_instance_url_without_scheme })
Ruby
<p>Review the following HTTP Notification:<br />
<%
record_url = EntityRootDefinitionSingleton.getInstance().getSystemSettings().getSystemSettingValue('io_instance_url') + '/#io_admin/io_http_notification/' + record.id - Domain Name For Sale | Dan.com
record_link = "<a href='#{record_url}</a>"
%>
<%= record_link %>
</p>
Groovy
<p>Review the following HTTP Notification:

<a href="${ctx.io_instance_url}/#io_admin/io_http_notification/${io_uuid}">${ctx.io_instance_url}/#io_admin/io_http_notification/${io_uuid}</a>

</p>
For more information:
Was this helpful?