Part 2: SCSM Email Notifications And Subscriptions
This is Part 2 of a two part series on Email Notifications and Subscriptions.
Part 1: Notification Templates - the content of the message, based on a work item class
Part 2: Subscriptions - the trigger point to send the Notification template to a set of hard coded recipients or related recipients
Subscriptions control the trigger point for when an email is sent and the recipients of the email. And the Notification Channel is how the email is actually sent via SMTP.
Creating a Subscription
The General tab on creation allows you to set the work item type (Review Activity in the example below) and the unsealed management pack where the Subscription will be stored. These cannot be edited after the subscription has been created.
Groups and Queue selection can be used to limit the scope of the subscription. But I have usually found that Queues can add more complications than they are worth. Queues add in workflows that cause timing issues for analysts - they clash when the analyst updates a job and analysts "lose" jobs until the workflow runs. But that it is a blog post for another day.
Example Subscription Criteria:
The criteria is where the real magic of subscriptions occur. But first you have to set the notify option for the subscription, which will also change the available criteria options.
There are 3 options for when to notify:
On Creation - when an object is created the subscription will trigger. Used to notify when a new item is created.
On Update - allows starting values and end values. Used to capture state changes in the values.
Periodically - checks the item to see if it meets the criteria, allows you to set the time interval and the length of time it runs.
On Creation Criteria
The On Creation criteria are straightforward. When a new work item type (eg Review Activity) is created, the subscription workflow checks to see if it matches the criteria. If it does, then it triggers and sends the email.
On Update Criteria
The update criteria allows you to set starting values and end state values. Be careful with these as it can sometimes produce unexpected results.
For example in the screen shot below I have the Review Activity Tag changing from Test -> Templates as the main trigger, but have qualified it to only Review Activities that are in Progress. I did not need to set a start value for Status, as this could narrow the criteria too far and also I am not sure of what state the RA is starting in (Pending, On Hold, Completed).
Setting the start or end value off the criteria can be a useful way to qualify the trigger point of the subscription.
Periodic Notify: Allows Tokens in Date Criteria
Periodic notify is very useful when used with the [now] token for creating warning messages that can trigger before a scheduled date. The periodic settings allow you to set the frequency of when the subscription workflow runs and the number of times it will run for.
In this example I wanted it to check daily, with no end date (ie does not stop)
Out of the box, the [now] token is supported on date fields. As a trigger point this is the most useful of the criteria tokens, as the [me] and [mygroups] tokens don't make a lot of sense when there is no user context to evaluate against.
Another example of the Periodic Notify and [now] token is a "nag" email on a Review Activity that has not been approved.
In the example below, the trigger is that the RA is still In Progress and the last modified date is older than 2 days ago. The assumption here is that the last modified event would be from the workflow marking the RA as In Progress. This subscription would then send another approval email to the reviewers, generally using a new template with different wording eg Resend in the title and more urgent words in the body.
You could even have another subscription that after 3-5 days of the last modified date and still In Progress, that sent an email to different recipients eg the Change Manager, indicating the approval has not been received yet.
Disabling and Re-Enabling Subscriptions - Warning!
Be careful re-enabling subscriptions that have been disabled. In this case the subscription will trigger against all work items since it was disabled and will send out potentially a lot of emails. You would expect it to just start for new work items that meet the criteria, but that is not the case.
This can cause a shock if the subscription has been disabled for some time and a lot of emails start going out to end users.
To avoid emails being sent out and confusing end users you have the following options: 1. Recreate the subscription as a new subscription ie delete the old subscription 2. Change the recipients on the subscription to a fixed email address, yours for example, and then re-enable the subscription. Change the recipients back after all the emails have stopped arriving 3. Change the subscription criteria to something that does not match any work items. 4. Change the template the subscription uses to include a keyword that the Exchange Administrators have a transport rule on to catch, see our [UAT] Subscription Testing blog post. My preference is to go with Option 2 or 4 as this has the least impact on your subscription and you can see the result of turning the subscription back on.
By adding a keyword, like [UAT] to the notification template you can use an Exchange transport rule to redirect any mail coming from the Notification Channel email address with the keyword in the subject to your mailbox. This way you can use production Service Manager work items to test your template and subscription, without sending emails to end users.
Refer to our previous blog on SCSM Subscription Testing for the full explanation.
Activity tags to target notifications
Targeting notifications can be difficult as you generally want specific templates with content appropriate for each targeted audience. For example managers may require an overview where as technical staff may need more detail. Different templates will provide this, but getting them to trigger in the right circumstances may be hard.
A suggestion is to extend the activity with a work item tag, usually a list item. This lets you categorize the activity itself and provides another level to use in the subscription criteria.
See our previous blog post on SCSM: Activity Work Item tags for a full explanation and example.
Notification Channel and Relaying Email to External Users
The Service Manager Email Notification channel is what actually sends the email that is triggered by the subscription. The Email Notification Channel uses the Service Manager workflow account to send email.
The Notification Channel can be configured to use Anonymous SMTP or Integrated Authentication. When using Integrated authentication the workflow account must have send rights to the Exchange mailbox used as a reply address.
You can use On-Prem Exchange or office 365 Exchange. If you use Office 365, check this article out to configure relaying of email to external recipients "How to set up a multifunction device or application to send email using Office 365"
With On-Prem Exchange relaying to external recipients will work automatically with Integrated authentication, but for anonymous it will depend on how the Exchange Admins have configured the receive connector in Exchange.
using the Service Manager Exchange Connector to monitor the Notification channel email reply address is usually a good idea. This will then catch any replies and attach them to the relevant work item (if you added [ID] to the template subject line) or create new jobs if there is no ID.
Give the mailbox\email address a friendly name eg SCSM.Notify@company.com, something I did not do in this screen shot example:
Summary Email notifications are a crucial component of Service Manager and hopefully this two part blog series has provided useful background on how to use them.
Xapity Create Activity
Xapity Create Activity allows major Work Item types to be created from SCSM Change Requests, Release Records and Service Requests. For example, you can create a Change Request from a Service Request activity workflow and wait for it to be completed before progressing.
Xapity - Innovative Software for SCSM - Discover our Products