Add Reviewer From Self-Service Portal in System Center Service Manager

While using System Center Service Manager, we have several requests from customers that need to be translated into features. One of the most common requests I receive is how to let users select and add Reviewers to review activity from Self-Service Portal when they fill service request form. this scenario would handle several cases such as:

  • Line manager hierarchy not configured in AD
  • Reviewer on leave and need to specify replacement manually

In this Blog, we will go through step by step on how to Add this feature to your System Center Service Manager.

Solution Overview

You can use management packs to create custom workflow in System Center Service Manager. I have created a simple management pack that will run automatically with new review activity workflow. It simply takes all Configuration Items in Review Activity Related Items and search for it in CMDB. Any user found in Related Items will be added as a reviewer to selected Review Activity with options [Must Vote: False | VETO: True]

Installation Steps

As most of Service Manager management pack, deployment is a straightforward process:

1- Download Management pack files from here:

https://1drv.ms/u/s!AnxJlKcf-V7nja4a-Bxj9sQv8ZrnRA?e=OyEc2c

  1. Copy RelatedCIToReviewers.dll file to Service Manager Installation Folder in SCSM Workflow Server
  2. From Service Manager Console, Import ReviewActivityCIsToReviewers.mp Management Pack File.

How to Use it?

follow below steps to implement this feature and add users to reviewers from self-service portal:

  1. The process is very simple, when you build request offering, you may add new field for user prompts

2. In Configure Prompts, Select the following:

Class: Active Directory User (All basic classes)

Criteria (Optional): this may be required if you would like to scope this field to specific users only

Display Column: Display Name and Username

Options: all options here vary depends on your requirement. The only mandatory one is to check add user-selected objects to template object as related items and select target review activity.

Continue your request offering as normal.

3. One you publish your request offering, go and select it from portal

4. Click on refresh to view Active Directory Users

5. Select Users need to be added to the review activity related items

6. Submit your request.

7. Wait until Service Request in under progress and then open it and go to review activity

8. Open review activity and you should find selected users added as reviewers

Resources

This management pack was created using Service Manager Authoring. It simply runs when new review activity created and it automatically find, search in AD users and add reviewers from review activity related items.

The original PowerShell script is here:

Import-module smlets -Force
# Classes
$UserClass = Get-SCSMClass -Name Microsoft.AD.User$
$RAClass = Get-SCSMClass System.WorkItem.Activity.ReviewActivity$
$Reviewer_Class = Get-SCSMClass System.Reviewer$
$RIClass = Get-SCSMRelationshipClass -Name System.WorkItemRelatesToConfigItem 
# relationship classes
$RelWorkItemContainsActivity = Get-SCSMRelationshipClass System.WorkItemContainsActivity$
$RelWorkItemContainsReviewer = Get-SCSMRelationshipClass System.ReviewActivityHasReviewer$
$RelReviewerIsUser = Get-SCSMRelationshipClass System.ReviewerIsUser$
# Get related items
$RA = Get-SCSMObject -Class $RAClass -Filter "ID -eq $RAID"
$AssignedUser = Get-SCSMRelatedObject -SMObject $RA -Relationship $RIClass
foreach ( $Item in $AssignedUser)
{
# get AD user
$User = Get-SCSMObject -Class $UserClass | ?{$_.UserName -eq $Item.UserName}
$Reviewer1 = $null
# Set options on the Reviewer
$Reviewer_args = @{ReviewerID = "{0}"; Mustvote = $false; Veto = $true}
# add Reviewer
$Reviewer1 = New-SCSMObject -Class $Reviewer_Class -PropertyHashtable $Reviewer_args -NoCommit
$RAStep1 = New-SCSMRelationshipObject -Relationship $RelWorkItemContainsReviewer -Source $RA -Target $Reviewer1 -NoCommit
$RAStep2 = New-SCSMRelationshipObject -Relationship $RelReviewerIsUser -Source $Reviewer1 -Target $Item -NoCommit
$RAStep1.Commit()
$RAStep2.Commit()
}
$RA = ""
$AssignedUser = ""

Authors