SCSM Notifications with Orchestrator and SMLets

Author by Nathan Lasnoski

I needed to get notifications to Service Manager end users working within my Orchestrator runbooks.  I needed this because I've been building a lot of comprehensive workflow solutions for Service Manager by leveraging the Orchestrator as the end-to-end workflow mechanism and in doing so I want to have as many components of that workflow encapsulated in the Orchestrator process as possible.  I didn't want to build the workflow in Orchestrator and have the notifications setup as Service Manager subscriptions.   I went to build the workflow and added my "Get Object" activity from the Service Manager integration pack.  I however struggled to find the class that contains the notification addresses associated to a user.  I found that in order to get that information I needed to add the SMLets PowerShell commandlets.    Here is what I needed to do:   First, download and install the SMLets on your Orchestrator server.   You'll need to do a little tinkering to get SMLets working.  Here is a walkthrough:   In the workflow below we are monitoring for new activities which are created, then sending notifications to the assigned users using their primary SMTP address.  We could be providing additional filtering on the activities, but this will suffice for testing purposes.  You'll see that it is a relatively simple workflow. The first step is to get the new activity. We then get the related user and filter the user based on the "Assigned to User".  The previous step would have retrieved potentially multiple users, but by filtering we are able to ensure we only return the one we are looking for. We then retrieve the user's notification address by passing the SCObjectGUID into the retrieval of the user using SMLets and the related SMTP address.  "Set-ExecutionPolicy RemoteSigned Import-module smlets -Force $AffectedUser = Get-SCSMObject -ID "Previous Step SCObjectGUID" $endPoint = Get-SCSMRelatedObject -ComputerName INMS137 -SMObject $AffectedUser -Relationship $userPerf|?{$_.DisplayName -like '*SMTP'} $email = $endPoint.TargetAddress"   We then follow-up with the sending of the actual email to the user.  We pass the property of email into the send email activity. Happy notifying! Nathan Lasnoski


Nathan Lasnoski

Chief Technology Officer