Feeds:
Posts
Comments

Posts Tagged ‘workflows’

Sending email notifications regarding a working item in Service Manager is a common requirement that doesn’t really exist out of the box. Travis had published, a while ago, a plug-in called “SCSM SendEmail”. This plug-in though filling that gap, still was missing some of the common requirements:

  • Supporting only Incident – you cannot send email notifications about a service request.
  • Adding new email template required a new workflow and manual updates to the management pack XML, which means the end user cannot do it alone.
  • There is no way to send notifications to email addresses that do not exist in the SCSM user list. In my environment, for example, I needed to send the notifications to all the email addresses in a specific field of the work item.
  • Does not provide a way to “Set First Response” or change the work item status to “Pending”
  • It has some multi users/messages reliability issues:
    • When you are trying to send the same message content again, even if you are changing the template, it will not send it and there will be no indication that the message was not sent.
    • When you are trying to send a second message while the work item is open in the console, the first message will not be sent and there will be no indication as well.
    • When you are trying to send a second message while the work item is not open in the console and before the previous sending workflow has been started, it will send two emails but both with the content of the second message.

All these issues forced me to develop a custom solution (When I started to work on this, Travis’s project was part of the exchange connector and was not published as an open source).
I built the console task “Send notification” and a supporting workflow, using the “SendEmail Activity” that I showed in my previous post, which solved all of the above problems and also allowed the console user to choose between the affected user and the assigned user as the email recipient.

Send Notification Task

Send Notification Task

Send Notification Dialog Box

Send Notification Dialog Box

 

When you select “Affected Contacts” or “Both” as a recipient the email will be sent to the affected user and to any email address in the “alternate contact” field.
The templates drop-down list shows all the email templates that relate to an incident/service request depending on the current item type, this way any end user, with the right permissions, can simply add more templates and with no delay start using them.
In case the user tries to send a second message before the first one was sent, he will get a popup message to try again in a few seconds.

The solution contains two management packs:
C60.Incident.Notification.mpb –

  • Contains the types’ extension to incident and service request. I’m using the same extension field’s names as in Travis’s solution, adding one extra filed called “MessageToAssignedUser” that sets the notification recipient.
  • Contains the “Send Notification” Console Task and a supported assembly. The package also hides the out of the box “Mark as first response” and “Request User Input” console tasks.
  • Contains empty email templates (the email body will include just the message from the dialog box) for incident and service requests that will be used when the user chooses “No Template” in the templates combo.

C60.Incident.Notification.WF.xml –

  • Contains two workflows (one for incident and one for service request) that do the actual sending. Here is the workflow as shown in the authoring tool:
    Send Notification Workflow

    Send Notification Workflow

    The workflow’s trigger condition is when a work item’s “MessageTemplateId” field is updated from null to a different value. When executed, the workflow checks the “MessageToAssignedUser” field and based on its value sets the notification recipients:

      • True – will send the notification to the assigned user.
      • False – will send the notification to the affected user / contacts.
      • Null – will send the notification to the assigned user and the affected user / contacts.

    After the send email activity, the workflow will clear the “MessageTemplateId” field.

To deploy the solution, just import both packages using the SCSM console and copy the content of the “SCSMExtension” folder to the SCSM folder (%ProgramFiles%\Microsoft System Center 2012\Service Manager). The “SCSMExtension” folder contains an assembly for each workflow and my custom workflow activity assembly.

To open the workflows in the authoring tool you will need to deploy the custom workflow activities as described in my previous post.

The source code and binaries for this article are available here
Advertisements

Read Full Post »

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

SCSMCustomActivities

To send an email, drag the “Send Email Notification” activity to the required section on the workflow designer and configure the following properties:

Property’s Name
Description
EmailAddress List of email addresses, separated with semicolon, which will be added to the email recipient.
InstanceId Related object Guid. This object will be used as the template source object.
PrimaryUser1 Primary user’s internal Id (Guid) that will get the email.
PrimaryUserRelationship1 Full Name of the relationship to the instance class, which contains the primary user.
TemplateDispalyName2 Name of the email template that will be used.
TemplateId Email2 template internal Id (Guid)

1 – Either PrimaryUser or PrimaryUserRelationship has to be configured.
2 – Either TemplateDispalyName or TemplateId has to be configured.

Example:

SendEmailNotification Configuration

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.
The source code and binaries for this article are available here

Read Full Post »

The problem:
SharePoint workflows, which are based on Microsoft WF, are a great way to automate processes that require human interaction and can be easily managed through SharePoint designer, without any custom development. But when it comes to automating IT processes, Microsoft provides us with another workflows engine called Orchestrator (part of System center). The Orchestrator has a variety of activities and integration packs that make him a powerful tool for implementing IT runbooks.
I needed a solution for users who design SharePoint’s workflows, using the SharePoint designer, to easily create workflows that will include execution of Orchestrator’s runbook. Using the SharePoint OIP (Orchestrator Integration Packs) you can monitor a SharePoint list for a change and execute a runbook as a result (as described here). However, this monitoring approach is based on pooling, so for example, if I’m using the default 30 seconds for pooling interval with the above approach for a task that is usually required once a week, it will generate more than 20,000 unnecessary queries against the SharePoint. Then, when the user will update the list’s item it will take up to 30 seconds before the workflow will start.
And so, it would seem that triggering the runbook from SharePoint will be a much better solution.

(more…)

Read Full Post »