Administer > Administer Service Management > Studio > Notifications > Processing rules in notifications

Processing rules in notifications

The message body of a notification template can contain processing rules that embed data in the email sent to a recipient when the notification event occurs. For example, you might want to do one of the following:

Avatar rule

When the avatar rule runs, Service Management uses a person identifier (personId) to locate the linked avatar for that user. For example, you would insert ${:current_user.Id} to identify the email sender. The avatar becomes a parameter in the rule. Service Management can locate and attach the avatar image file to the message. The HTML image reference in the notification causes the actual avatar image to appear in the formatted email message.

Syntax <%=avatar(person id)%>
Description Replaces the rule with the avatar for the user identified by the person identifier.
Examples

<%=avatar(${:current_user.Id})%>

<%=avatar(${questionOwner})%>

Create URL rule

A similar rule creates a URL to reference data. When you embed the URL to the associated record, the user can easily open that record.

Syntax <%=create_url(relative url)%>
Description Replaces a relative URL with a full URL to a record.
Example

<%=create_url(/ess/question/${questionId})%>

You can embed the URL using the Create_url rule in one of the following ways:

  • Enter the rule directly in the text editor.
  • Click the link button in the editor toolbar and enter the rule in the Link dialog box. (Select the blank protocol option.) For more information, see How to create a notification template, in the step describing how to embed a URL in the message.

Note When you add a URL using the link button, you can edit the text of the link and the URL remains active. When you add a URL using directly in the text editor, the link cannot be edited. It appears in the message as you entered it.

Hide record name rule

In cases where a user does not have permission to view a record type, this rule hides the record name from such a user.

Syntax <%=task_parent_name(person Id, entity type, entity Id, entity name)%>
Description Hides the record name if the user does not have permission to view records of that type.
Example
<%=task_parent_name(${:current_recipient.Id},${:entity.ParentEntityType},${:entity.ParentEntityId},${:entity.ParentDisplayLabelKey})%>

Note This rule is intended for use with task notifications only. It is included in such notification templates out-of-the-box.

Conditional statement rule

You can define a rule to display a message only when a condition is satisfied. You can define a single message, which is displayed only when the condition is true, or two messages, one displayed for a true condition value and the other for a false condition value.

Syntax

Format 1:<%=conditional_statement(<Boolean expression>, 'Message')%>

Format 2: <%=conditional_statement(<Boolean expression>, 'Message_true', 'Message_false')%>

Description

In Format 1, the message is displayed when the Boolean expression is true. A blank string is displayed when the Boolean expression is false.

In Format 2, the first message is displayed when the Boolean expression is true. The second message is displayed when the Boolean expression is false.

Example

<%=conditional_statement(${:entity.Priority=='HighPriority'}, 'High priority record')%>

Related topics