The Problem:
There are many blog posts and discussions about sending email notifications from Service Manager. Although Out-of-the-box, Service Manager has strong capabilities for notifications such as:
- Template editor that allow the end user to insert relevant entity fields into the mail body
- The ability to allow the end user to specify events conditions that will trigger specific notification, using a simple wizard
What is missing is the capability to use this functionality from inside a SCSM Workflow. There are some solutions provided by Travis (SendEmail) and German (http://scsmsource.blogspot.co.uk/2011/04/work-item-assignmentreassignment.html), however both these solutions do not allow customization to the workflow in the Authoring Tool. In my SCSM environment I needed the capability to send notifications as part of more complex workflows and was also required to send the notification to external emails not defined in the SCSM users DB.
The Solution:
After learning German’s solution, I noticed that he is using an out-of-the-box workflow (from the ‘WorkflowFoundation’ assembly) to send the notifications. I dug deeper (using reflector), and found that the workflow used an activity called ‘SendNotificationsActivity’ – exactly what I was looking for. Unfortunately, this activity is not compatible with the authoring tool, so to use it, I needed to wrap it with my own custom activity. In doing so, I also added a property that can contain email addresses, separated with semicolon, and these addresses will be added to the email recipients. (Link to the final result + source code can be found at the bottom of this post).
The attached assembly contains the “Send Email Notification” activity and some other useful activities that can help build more advanced workflows. For deployment follow these links: How to Install a Custom Activity Assembly
To send an email, drag the “Send Email Notification” activity to the required section on the workflow designer and configure the following properties:
* Either PrimaryUser or PrimaryUserRelationship has to be configured.
** Either TemplateDispalyName or TemplateId has to be configured.
Similar to the other solutions, this solution is not supported by Microsoft, which means that you might need to do some adjustments in future version of SCSM. Hopefully, these kinds of basic capabilities will be in the product itself in the next version and we will not need such custom solutions.
In the next post I will show you how I used these activities to create improved “SendEmail” solution.
Get the source code and binaries for this article here