Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
HTML Email
The Service Manager HTML Email Solution enables Service Manager to send HTML email messages automatically or manually on demand. This email solution is based on HTML templates that can be customized and localized.
This document describes how to install this solution, how it works, how to customize HTML email notifications, and how to send on-demand notifications.
Audience
HTML Email is intended for the following audiences:
- System administrators who manage notifications
- System administrators who manage Service Manager email setup
- Engineers who send HTML emails to notify users
Prerequisites
This solution requires the following prerequisites:
- Service Manager9.61 (server runtime environment and applications)
- SMTP for email notifications
- Email configurations (See Email setup notes )
How the solution works
The Service Manager HTML Email Solution works as follows.
Components of the solution
The HTML Email Solution uses the following components:
- Notification definitions (in the notifications table)
- HTML templates (in the htmltemplates table)
- JavaScript functions (in the htmlemailtemplate record in the ScriptLibrary)
- The eventout table (available in the existing email notification mechanism)
HTML templates
HTML templates are records saved in the htmltemplates table. Each record defines the common HTML elements that are included in each email message and parameters that are to be replaced with specific values. Each htmltemplates record includes general information, HTML source with parameters, and expressions that are used to evaluate the parameters.
Each HTML template can have multiple language versions. These language versions are defined in separate htmltemplates records with the same name but different language codes, containing localized content.
For information about how the system chooses the language in a notification email, see Language for notification emails
Note To manage or create HTML templates, users must have either the SysAdmin or the HTMLTemplatesAdmin capability word.
Note The auditing feature is enabled by default for the htmltemplates table. When modifications are detected, an Audit Log entry is recorded for each changed field.
Notification definitions
HTML email notifications are also defined in notification records. However, instead of referencing a plain-text message or a predefined format, each HTML email notification record always references a message record with an msg class of HTMLTemp and an id of 1. This message record is only a wrapper. The actual message body and subject are generated by a jscall expression in the Arguments field that returns HTML text by evaluating the corresponding HTML template.
The Arguments expression for the message body calls the getMailBody function to obtain the body HTML code, and the Arguments expression for the message subject calls the getMailHeader function to obtain the subject HTML code. The template name and the record that triggers the notification are passed in as arguments.
Below is an example for notification ChM Change Approval:
The Message tab
Field | Value |
---|---|
Msg Class | HTMLTemplate |
Msg No. | 1 |
Arguments | jscall( "htmlemailtemplates.getMailBody", "ChM Change Approval Approved", $L.file, $L.file.save, requested.by in $L.file) |
Condition | category in $L.file~="Subscription" |
Notify Method | |
Recipient(s) | requested.by in $L.file |
The Email/Mail Subject Line tab
Field | Value |
---|---|
Msg Class | HTMLTemplate |
Msg No. | 1 |
Arguments | jscall( "htmlemailtemplates.getMailHeader", "ChM Change Approval Approved", $L.file, $L.file.save, requested.by in $L.file) |
ScriptLibrary record
Both the getMailBody and getMailHeader functions are defined in an htmlemailtemplates ScriptLibrary record.
getMailBody
The getMailBody function returns the HTML body for the email message that is sent for a specific record. This function takes the following arguments:
Argument | Required | Description |
---|---|---|
templateName | Yes | Specifies the name of the HTML template. |
$RECORD | Yes |
Specifies the record that triggers the email notification. This record contains data that is used to construct the email message. Example: $L.file |
$RECORDOLD | Yes |
Specifies the pre-update version of the record that triggers the email notification. Example: $L.file.save |
recipient | No | This argument is reserved. The email message will always be sent to the recipient defined in the notification record. |
lang | No |
Specifies the language code of a specific language version of the HTML template. This argument is typically used if you always send this notification in a certain language. If this argument is not specified, Service Manager takes the recipient's default language when determining which language version of the HTML template to use. For each recipient, Service Manager detects:
If the recipient is a distribution group and all its members have the same default language, the common default language is used. If the members of that distribution have different default languages, the system default language is used. Example: de |
Note The Arguments field in the notification record takes only RAD expressions. Therefore, the expression must use a jscall function to call the getMailBody function in the ScriptLibrary. A typical expression resembles the following:
jscall("HTMLTemplates.getMailBody", "SM Add", $L.file, $L.file.save)
getMailHeader
The getMailHeader function returns the subject for the email message that is sent for a specific record. This function takes the following arguments:
Argument | Required | Description |
---|---|---|
templateName | Yes | Specifies the name of the HTML template. |
$RECORD | Yes |
Specifies the record that triggers the email notification. This record contains data that is used to construct the email message. Example: $L.file |
$RECORDOLD | Yes |
Specifies the pre-update version of the record that triggers the email notification. This record contains data that is used to construct the email message. Example: $L.file.save |
recipient | No |
This argument is reserved. The email message will always be sent to the recipient defined in the notification record. |
lang | No |
Specifies the language code of a specific language version of the HTML template. This argument is typically used if you always send this notification in a certain language. If this argument is not specified, Service Manager takes the recipient's default language when determining which language version of the HTML template to use. For each recipient, Service Manager detects:
If the recipient is a distribution group and all its members have the same default language, the common default language is used. If the members of that distribution have different default languages, the system default language is used. Example: de |
The Arguments field in the notification record takes only RAD expressions. Therefore, the expression must use a jscall function to call the getMailHeader function in the ScriptLibrary. A typical expression resembles the following:
jscall("HTMLTemplates.getMailHeader", "SM Add", $L.file, $L.file.save)
Eventout table
A record is created in the eventout table for each email notification. The eventout record remains until it is picked up by the JavaMail agent.