SCSM–Custom Console Task: Change Status To In Progress

February 9, 2013 at 9:06 am in Service Manager, System Center 2012 SP1 by Valérie Siroux

Most of my customer create one or more custom statuses like In Progress.

In Service Manager 2012, changing the status to In Progress requires many clicks.
The console tasks used to change the status of an Incident are grouped in a parent task called "Change Incident Status". When you want to update the status to In Progress, there are to many steps required: Change Incident Status –> Other –> Select the correct status –> Click OK.

image

To motivate analysts to always keep the incident status up to date, we searched for a way to update statuses with one single click.
This means we need to create tasks at the root level.

There is already a custom management pack available in the Technet Gallery to do this for the default statuses (Activate, Resolve,Close). Download & Import this management pack (http://gallery.technet.microsoft.com/Service-Manager-2012-b558f3ac).

Now, we only need to create console tasks for our custom status, in this case, In Progress.
First, we need to get the ElementId for this status.

Export & Open the Management Pack which contains your custom status (Default: Service Manager Incident Management Configuration Library).
Scroll down to the DisplayStrings section and search for the Display string with Name: In Progress.
Note down the value in ElementID, in this case InProgress.Enum (Note: when creating a status using the lists in Service Manager your elementID will look like enum.<GUID>, use this value)

image

Go to Library , Tasks and Start the Create Task wizard.

image
Task Name: In Progress
Description: Change the incident status to In Progress
Target Class: Incident
Management Pack: I used the same management pack as the one from the Technet Galleries,  you can create a new MP or use an existing.

image
Categories: Where will the task be displayed. I selected Incident Management Folder Tasks.

image

Full path to Command: powershell.exe
Parameters: cd ‘C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell’;Import-Module .\System.Center.Service.Manager.psd1; $IncidentClass = Get-SCClass -Name System.workitem.incident;$Incident = Get-SCClassInstance -Class $IncidentClass -Filter ‘Id -eq $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$’;If ($Incident.count -gt 0) { $Incident | Foreach-Object {$_.Status = ‘InProgress.Enum’;Update-SCClassInstance -Instance $_}; };
Log in action log when this task is run: Enabled
Show output when this task is run: Enabled.

Note: Update the InProgress.Enum to the value you found in the previous step.

The In Progress task is displayed in the incident management folder, and should be working.

But we still need to do some fine tuning to the task: Add an image and only show the task when an incident is selected.
There is no way to do this using the SCSM GUI, so we need to change the management pack XML code.

Export the management pack and open it in an xml editor.

Scroll down to the DisplayStrings section and find the DisplayString with In Progress in the <Name> Tag. Copy/Note down the ElementID.
image

Search for the <Categories> tag, and look for the <category> with the ElementID from the previous step as target.

image

Update the Value from: SMIncident!ServiceManager.IncidentManagement.IncidentManagementFolderTasks to SMConsole!Microsoft.EnterpriseManagement.ServiceManager.UI.Console.MultiSelectTask

Your category should look like this now:    <Category ID="Category_7112A19A5D9C497D8BEB78A9D23B2D9B65D92CC1" Target="ConsoleTask.c5d9d01115684a04a6ddfc646dd77c8d" Value="SMConsole!Microsoft.EnterpriseManagement.ServiceManager.UI.Console.MultiSelectTask" />

Now, search for the <ImageReferences> tag. (You can create the tag if it doesn’t exist)
And add an image reference for the in progress status:

<ImageReference ElementID="ConsoleTask.c5d9d01115684a04a6ddfc646dd77c8d" ImageID="SMIncident!IncidentMgmt_IncidentStatusChange_16" />

Note: Update to the ElementID in yellow to the ElementID you found in the previous step.

image

 

Update your Management Pack Version number and re-import the Management Pack.

The task is displayed correctly:

image