MEMOEXP

Our System Center Memo

SCSM Approve by Email

With the Exchange Connector, approvers can approve a SR using emails. But it still require them to key in a specific keyword. Let’s be honest, how many managers will actually do that, or knows how to do that? Many of them are end users. Here’s what we can do to help them.

I’m using SCO to accomplish this though, you can try to modify the script a bit to make it fit into SCSM Notification Templates. Skip right to step 10 if all you need is the HTML script, or follow through if you need a more step to step guide. I’m assuming you know the basics of SCO, if not let me know and I’ll help you personally.

  1. This is how my Runbook looks like.
     image

  2. These are the data that I require so I will need to get it. If you already know how, skip this part. If not you can refer to my other post here to see how I got the info.
    image
  3. First we need to find out who is the Reviewer. You can do it by following the steps below.
    image
  4. Next we need to find out more information about the Reviewer. Do this.
    image
  5. The next part is to get the Email of the Reviewer. Paste the following script into the Details tab.
    image

    $Session = New-PSSession -ComputerName ‘YOUR SERVER NAME
    $Email = Invoke-Command -Session $Session -scriptblock{

    Import-Module SMLets
    $SID = "\`d.T.~Ed/{141E367C-147B-4752-9FDF-DC983B1059BD}.SCObjectGuid\`d.T.~Ed/"
    $Reviewer = Get-SCSMObject -ID $SID
    $endPoint = Get-SCSMRelatedObject -SMObject $Reviewer -Relationship $userPerf|?{$_.DisplayName -like ‘*SMTP’}

    $email = $endPoint.TargetAddress
    Remove-PSSession $Session
    $email
    Remove-Module SMlets -Force
    }

  6. At the Published Data tab, create the following.
    image 
  7. On the Get RA activity, this is what we need to do. The reason I’m pulling data from here is so that I can provide more information in the email. Skip this step if you don’t require it.
    image
  8. Next I want to find out the SR number and details. On the Find SR activity, do this.
    image
  9. On the Get SR activity, follow this. Again like step 7, I’m doing this step is because I want more information to be available when I send the email out.
    image
  10. Now we have gotten all the information we require, this is what we need to do at the Send Email activity. I’m assuming you know what to do on the Subject and Recipient, so I’m going straight to the point of this blog post, which is the Message part. Post the following script there.
    image 

    I’ve bolded the place you need to change. Spot the 2 YOUR EXCHANGE CONNECTOR EMAIL below? Please replace that with your exchange connector mailbox address.

    <html>
    <style>
    .button-link {
        padding: 10px 15px;
        background: #4479BA;
        color: #FFF;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        border: solid 1px #20538D;
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
        -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
        -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);

    }
    a:link {text-decoration:none;}
    a:visited {text-decoration:none;}
    a:hover {text-decoration:none;}
    a:active {text-decoration:none;}
    </style>
    <body>

    <br>Dear \`d.T.~Ed/{DAF11E13-864B-4540-B9B0-7F73397489F4}.DisplayName\`d.T.~Ed/,<br><br>

    Please be informed that a Service Request has been raised by your staff and is awaiting your approval. Following are the additional details:<br><br>

    <table>
    <tr>
      <td width=210>
      <p><b>Activity ID</b></p>
      </td>
      <td>
      <p>: \`d.T.~Ed/{8B51B658-14FF-4852-993C-DC3D4A21268E}.Id\`d.T.~Ed/</p>
      </td>
    </tr>
    <tr>
      <td width=210>
      <p><b>Service Request ID</b></p>
      </td>
      <td>
      <p>: \`d.T.~Ed/{1AF2A8A7-8BB5-4096-AD60-16D1D064EF3C}.Id\`d.T.~Ed/</p>
      </td>
    </tr>
    <tr>
      <td width=210>
      <p><b>Requestor</b></p>
      </td>
      <td>
      <p>: \`d.T.~Ed/{5447702A-F39E-4844-BF45-48249C232532}.DisplayName\`d.T.~Ed/</p>
      </td>
    </tr>
      <td width=210>
      <p><b>Service Request Title</b></p>
      </td>
      <td>
      <p>: \`d.T.~Ed/{1AF2A8A7-8BB5-4096-AD60-16D1D064EF3C}.Title\`d.T.~Ed/</p>
      </td>
    </tr>
    <tr>
      <td width=210>
      <p><b>Service Request Description</b></p>
      </td>
      <td>
      <p> <pre style ="margin-top: 0px; font-family:Arial,Helvetica,sans-serif; font-size:16px;"> \`d.T.~Ed/{1AF2A8A7-8BB5-4096-AD60-16D1D064EF3C}.Description\`d.T.~Ed/</pre></p>
      </td>
    </tr>
    </table>

    <br>
    <table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 align=left
    style=’background:#4472C4;mso-background-themecolor:accent5;border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;
    mso-table-overlap:never;mso-yfti-tbllook:1184;mso-table-lspace:9.0pt;
    margin-left:6.75pt;mso-table-rspace:9.0pt;margin-right:6.75pt;mso-table-anchor-vertical:
    paragraph;mso-table-anchor-horizontal:column;mso-table-left:left;mso-table-top:
    .05pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt’>
    <tr style=’mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes’>
      <td width=95 valign=top style=’width:70.9pt;border:solid windowtext 1.0pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt’>
      <p class=MsoNormal align=center style=’margin-bottom:0cm;margin-bottom:.0001pt;
      text-align:center;line-height:normal;mso-element:frame;mso-element-frame-hspace:
      9.0pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;
      mso-element-anchor-horizontal:column;mso-element-top:.05pt;mso-height-rule:
      exactly’><a style=’display:block’
      title="Click here to Approve" href="mailto:YOUR EXCHANGE CONNECTOR EMAIL?subject=[\`d.T.~Ed/{8B51B658-14FF-4852-993C-DC3D4A21268E}.Id\`d.T.~Ed/]&body=[Approved] Approved by email"><span style=’color:white;
      mso-themecolor:background1;text-decoration:none;text-underline:none’>Approve</span></a></p>
      </td>
    </tr>
    </table>
    <table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
    style=’background:#4472C4;mso-background-themecolor:accent5;border-collapse:
    collapse;border:none;mso-border-alt:solid windowtext .5pt;mso-yfti-tbllook:
    1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt’>
    <tr style=’mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes’>
      <td width=94 valign=top style=’width:70.5pt;border:solid windowtext 1.0pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt’>
      <p class=MsoNormal align=center style=’text-align:center’><span
      style=’color:white;mso-themecolor:background1′><a style=’display:block’
      title="Click here to Reject" href="mailto:YOUR EXCHANGE CONNECTOR EMAIL?subject=[\`d.T.~Ed/{8B51B658-14FF-4852-993C-DC3D4A21268E}.Id\`d.T.~Ed/]&body=[Rejected] Rejected by email"><span style=’color:white;
      mso-themecolor:background1;text-decoration:none;text-underline:none’>Reject</span></a><o:p></o:p></span></p>
      </td>
    </tr>
    </table>
    <br>

    Thank You<br>
    Service Desk<br>
    <br>

    NOTE: This is an automated e-mail generated by System Center Service Manager. Please do not reply to this email. If you need further assistance and/or clarification, please contact Service Desk.
    </div></body>

    </html>

  11. The end result of this? 2 nice little buttons at the bottom that your approvers can click to either Approve or Reject the request.
    image

    I’ve white out the contents of this email, but the point is the 2 buttons below. When they click the buttons, it will open out a New Email page that they can key in their comments, or if they choose to, simply just click Send, and Exchange Connector will do the rest.

     

July 18, 2014 Posted by | System Center Orchestrator (SCO), System Center Service Manager (SCSM) | Leave a comment

SCSM Email New Reviewer / Approver

When a new Reviewer is added into the activity, we would like them to receive an email notification as well. We can achieve this using SCO.

  1. The Runbook will look like this. Let’s go through them 1 by 1.
    image 

  2. On the first activity, Monitor Reviewer, we want to monitor against the Reviewer class, and set the trigger as New. This activity will now trigger whenever a new Reviewer is added to any RA.
    image
  3. Next we need to find out which RA was the Reviewer added to. Follow the settings below.
    image
  4. Now that we know which RA it was from the previous activity, we need to dig into the SR to get more information about it.
    image
  5. Now we have all the information we need. Who is the Reviewer and what is his/her email, and which is the correct RA and SR. With this information we can immediately use the Send Email activity to trigger the email. In my case, I use it to call for a different Runbook which can be found here.
    image

Hope this helps. Drop me a message if you need more guidance.

July 18, 2014 Posted by | System Center Orchestrator (SCO), System Center Service Manager (SCSM) | Leave a comment

SCSM View All Reviewer Comments

When we have a workflow with multiple levels of Review Activities, it might be important to pass the comments of all the Reviewers to the Implementer for them to make informed decisions when doing the work. It is however, difficult to navigate through all RA just to do that, in order to make life easier, here’s what we can do.

  1. You’re going to need multiple Runbooks, the first one would be something like this. What this does is it will monitor the RA, and whenever it goes into Completed status, it will parse the reviewer comments into the SR of the RA. I created a custom string field in SR for this.
    image

  2. Take note on the Update SR activity, it needs to be something like this or else the earlier comments will always be overwritten by the later comments.
    image
  3. Now create another Runbook that monitors MA. When a MA goes to In Progress status, this Runbook will grab all the comments from the SR and parse it into the MA, you can put it in the description field if you want to.
    image 

Now whenever a MA becomes Active, it will be updated with all the Reviewer Comments. You can use this for RA as well and parse all previous Reviewer Comments to the later RA so that the next Reviewer can know the decisions made earlier as well, and by whom.

July 17, 2014 Posted by | System Center Orchestrator (SCO), System Center Service Manager (SCSM) | Leave a comment

SCSM Adding Dynamic Activities

Sometimes we want to dynamically add activities depending on what the user selects in a Service Request. If you’ve tried using SCSM’s template to do this you’ll realize that the activities added will be in a mess and it won’t work. You’re going to need to rely on SCO for this.

I’m posting this under the assumption that you know a little bit about SCO, if not, let me know and I’ll guide you separately. If there’s enough volume I’ll write a comprehensive guide.

In this guide, I will be using a PowerShell script NOT WRITTEN by myself, I’m not sure where it originated from, so credits to whoever wrote it.

  1. First build a SCO Runbook, it may look something like this. You’ll need to parse the SR ID and the SC Object Guid of the Service Request into the Initialize Data activity.
    image

  2. Under Details, paste the script below.
    image 

    $Session = New-PSSession -ComputerName ‘Your SCSM MS Name
    $SeqNo = Invoke-Command -Session $Session -scriptblock{

    Import-Module SMLets
    # Define Service Request
    $SR="\`d.T.~Ed/{7050956A-3E50-4D80-B856-8AD0E62AE3FF}.{A02080CB-E323-4056-BDAA-B8B92B971F8C}\`d.T.~Ed/"
    # Get Service Request Class
    $SRclass = Get-SCSMClass -Name System.WorkItem.ServiceRequest$ 
    # Get object relationship 
    $SRMAObjectRelClass = Get-SCSMRelationshipClass System.WorkItemContainsActivity
    # Get SR Object
    $SRobject = Get-SCSMObject -Class $SRclass -Filter "ID -eq $SR"
    #$SRobject
    $Activityobjects =  @(Get-SCSMRelatedObject -SMObject $SRobject -Relationship $SRMAObjectRelClass )
    $Seq = $Activityobjects.count
    $Seq
    Remove-PSSession $Session
    Remove-Module SMlets -Force
    }

  3. Under Published Data, add the following.
    image
  4. Add the Create Related Object activity into the Runbook and set it following the screenshot below. For ID, if you leave the it at {0}, it will use the latest available ID number, which is what you want. But make sure you add the prefix such as MA or RA behind or you’ll end up with a ticket number without a prefix.
    image
  5. Using this method you can now dynamically add a MA or RA, and it will be added according to the sequence you want, instead of it randomly being arranged on your workflow.

July 17, 2014 Posted by | System Center Orchestrator (SCO), System Center Service Manager (SCSM) | Leave a comment

SCSM Head of Department / Division Approval

SCSM allows us to dynamically get the Line Manager of an Affected User, but how about if we want SCSM to dynamically get the Head of Department or Division? A Crude way will be to use update AD to put in the HOD in the Manager field, a better way would be to use SCO.

I’m making this guide under the assumption that you know some SCO, if not, inform me and I’ll make help you separately. If there’s enough volume I’ll make a detailed step by step guide.

 

  1. Now the Department is something that SCSM already import from AD. That’s a field we can use. Depending on the User’s Department, we can determine the HOD. Your workflow will need to be something like this.

     image 

  2. The important thing here is the Find HOD step, which reads from a XML. Here’s how the XML should look like, pretty simple. It simply means if the Department of the User is IT Services, it will return with a Query Result of jyeoh. Create your own list, and save the file as .xml.

    This works with all languages, I even tried it with Thai, just make sure you save the file as Unicode. This XML file is cased sensitive, take note of that. If your file is properly coded, you will be able to view it via Internet Explorer. If it displays blank, there’s something wrong with your code.

    image

  3. <DepartmentCode>
      <Department Code="IT Services"         HOD="jyeoh"         Type="string" />
      <Department Code="IT Security"         HOD="btey"         Type="string" />
    </DepartmentCode>

  4. Back to the Find HOD activity, your XPath Query will be something like this.

     image

  5. Now to the Get HOD activity, set the settings according to the screenshot.

    image 

  6. Your Return Activity should now have the SC Object GUID of the HOD, which you can now use to create or update the necessary RA activities.

Following this idea, you can create many other types of dynamic workflows. Let me know if this is of interest and I may provide more details.

July 17, 2014 Posted by | System Center Orchestrator (SCO), System Center Service Manager (SCSM) | Leave a comment

Follow

Get every new post delivered to your Inbox.