How to use Notification Rules to Control Mail Transmissions

Document ID : KB000010761
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

This document discusses the basics of creating a series of Notification Rules.
One can imagine a multitude of scenarios in which a mail would need to be sent out based on specific conditions and that same mail needs to be sent to specific individuals, such as the affected end user is a high ranking official results in a custom mail sent to an escalation team.

Background:

Scenario:  You need to create two distinct notifications when a ticket has been created.  Depending on the named group on the ticket, Group-1 or Group-2, a notification would go out to different personnel per rule.  If the ticket is assigned to Group-1, notify the named Assignee only.  If the ticket is assigned to Group-2, notify the named Affected End User only.

Environment:
CA Service Desk 12.9 and higher.
Instructions:

To accomplish this, it is easiest to work backwards when developing the notification rules.  By creating the Notification Templates, the Conditions, and then the Notification Rules to tie the defined Conditions and Template together, one can then apply the defined Rules directly to the Activity Notification.

Step 1:  Create the Notification Message Templates

We will create Template-1, which applies toward Group-1, and Template-2, which applies to Group-2

For each template:

-          Go into Administration Tab, and navigate to Notifications -> Message Templates.

-          Click "Create New"

-          Fill in the Message template content (See Figure 1 and Figure 2).  This is where you may elect to write a custom message to be sent per Notification Rule (ie:  you want to send one specific message to Group-1 and a completely different message to Group-2).  Save with symbol "Template-1"

-          Repeat the same process, creating a second template, which will be saved with symbol "Template-2" (See Figure 2)

After you have created both Templates, you should have the two listings show up as Message Templates available for your usage. (See Figure 3)

Figure 1:  Create New Message Template for notifying Group-1
1.jpg 


Figure 2:  Create New Message Template for notifying Group-2
2.jpg

Figure 3:  Message Template List showing both Templates created.
3.jpg

 

Step 2:  Define each Notification Rule Condition

For each rule, you will need to create each of the Site-Defined Condition Macros, which, when they assess as true, will result in the Notification Message Template being triggered

We will create "Group is Group-1" and "Group is Group-2" Site Defined Conditions.

For each Site Defined Conditional Macro

-          Go into Administration Tab, and navigate to Events and Macros -> Macros

-          Click "Create New"

-          Fill in the Macro contents, saving the new macro as "Group is Group-1".  (See Figure 4, Figure 5, and Figure 6)

-          Repeat the same steps, creating a second macro and saving as "Group is Group-2 (Figure 7, Figure 8, and Figure 9)

Figure 4:  Creating the new macro "Group is Group-1"
4.jpg


Figure 5:  Creating the Atomic Condition which will check if the specified group attribute equals "Group-1"

5.jpg

Figure 6:  The "Group is Group-1" macro is created, with the given condition specified in Figure 5 listed
6.jpg

Figure 7:  Creating the new macro "Group is Group-2"
7.jpg

Figure 8:  Creating the Atomic Condition which will check if the specified group attribute equals "Group-2"
8.jpg


Figure 9:  The "Group is Group-2" macro is created, with the given condition specified in Figure 8 listed

9.jpg 


Step 3:  Build each Notification Rule.

It is important to understand that every Activity Notification has a Default Notification Rule.  It is strongly advised that you do not tamper with any part of this rule and only use it to model any rule elements that you need, ie, use the content from its Notification Template in your own custom templates.

While one can technically recycle the Default Notification Template in any custom rule, it is advised that a copy of any such Default Notification Template be used, and named uniquely to match the Rule that it is associated.

We will assemble each Notification Rule and create rules "Rule 1 - Group 1" and "Rule 2 - Group 2" as follows.  The Notification Rule ties the Notification Message Template and Notification Rule Condition together, hence why we created the Notification Message Template and Notification Rule Condition first.

For each Notification Rule:

-          Go into Administration Tab, and navigate to Notifications -> Notification Rules.

-          Click "Create New"

-          Fill in the Symbol for the Rule, in this case "Rule 1 - Group 1" and click “Save and Continue”  (see Figure 10)

-          Enter the “Condition” field as the Macro that was previously created, in this case "Group is Group-1".  Enter the “Message Template” field, the template that was previously created, in this case "Template-1".  Enter in the contacts who is meant to receive this notification, in this case, the Assignee (see Figure 11).

-          Repeat the same steps as before, to create a new Rule that pertains to Group 2, in this case "Rule 2 - Group 2" and populate the same fields as before with the corresponding "Condition" field, value "Group is Group-2", the corresponding "Message Template" field, value "Template-2", and the contacts meant to receive this notification, in this case, the Affected End User. (see Figure 12 and Figure 13)


Figure 10:  Creating a new Notification Rule "Rule 1 - Group 1"

10.jpg


Figure 11:  "Rule 1- Group 1" with Condition, Message Template, and Object Contact Notification List fields populated.

11.jpg


Figure 12:  Creating a new Notification Rule "Rule 2 - Group 2"

12.jpg


Figure 13:  "Rule 2- Group 2" with Condition, Message Template, and Object Contact Notification List fields populated.

13.jpg

 

Step 4:  Add each Notification Rule to the Initial Activity Notification.

Now that we have built the following for each scenario: 

-          Notification Message Template

-          Notification Rule Condition

-          Notification Rule (tying the Notification Message Template and Notification Rule Condition)

 
We will now add the Notification Rules to the Activity Notification.  To do this:

-          Access the Initial Activity Notification (Administration Tab, Notifications -> Activity Notifications).  By default, it will look like what is seen here in Figure 14.

-          Click on Update Notification Rules. Under Symbol, search for "Rule%Group%" (See Figure 15)

-          Add the generated rules in the listing. (See Figure 16)

-          Save.  The new rules will be populated to the Notification Rules List for Initial Notification (see Figure 17)

 

Figure 14:  Default content in the Initial Activity Notification
14-1.jpg


Figure 15:  Notification Rules Search

15.jpg

Figure 16:  Adding the two rules created "Rule 1 - Group 1" and "Rule 2 - Group 2"
16.jpg


Figure 17:  Updated Initial Activity Notification showing the two rules added in.

17.jpg

Additional Information:

- By default, all active rules listed in the Activity Notification will fire and operate.  The conditions that are associated with the rule will determine if the notification will actually fire.

- The basic method that a given notification rule would follow is "if <condition> is TRUE, send notification based on <notification template>".  There is no additional logic that can be executed beyond this on a given rule.  If the <condition> provided is blank, it will ALWAYS evaluate to TRUE and a notification is sent.

- There are three methods to prevent a given Notification Rule from sending out a notification altogether.

  • Render the given Notification Rule as Inactive
  • Remove the Notification Rule from the Activity Notification entirely.
  • Set "Auto Notify" to "No" in the Notification Message Template

- The above rules defined all have "Auto Notify" set to "No" in the Notification Message Template by default.  To actually have the notification sent out per rule, turn on this flag in the corresponding Notification Message Template

- Service Desk will act on at least the test of the condition entered in the Notification Rule to assess if the Notification will send out, if the condition resolves to "true".  This action on the part of the Notification Rule is independent of the corresponding Notification Message Template's "Auto-Notify" function.  While no notification will send out if the condition resolves to "false", Service Desk does need to perform at least the test of the condition when the rule is assessed. 

This is important to note as Notification Rules would require the attention of the spelsrvr process to evaluate the condition at the very least; excessive Rules specifications, even if they don't actually send a notify per the condition evaluating to false, can lead to performance issues on the spelsrvr process.  Only disabling the Notification Rule altogether stops the condition from being evaluated altogether.

 

- It is not possible in Activity Notifications to directly delay a notification from going out, as one would find in Event based notifications, such as SLA's.  Notifications may be delayed by virtue of the associated workshift of the recipient.