Within Change Request templates in SCSM, it is common to add a Review Activity to the workflow to ensure the relevant people are aware of, and agree the change can taking place.  Placing a review activity at the beginning of a workflow (as in the image below) ensures that no other activities to actually do any work take place, and provides an audit trail for the change.


If you are lucky enough to work in an environment with a fixed set of approvers, this is an easy and straightforward approach, as the CR template can contain the review activity with the relevant approvers.  However, if you are in an environment where the approver can change based on the service or application being affected, for example, this process becomes a bit more long-winded for the person creating the CR, as they now have to know who the approver should be, manually open up the Review Activity in the workflow and add/amend approvers as required.

With Service Manager workflows though, this needn’t be an issue, because we can run a script at the time the CR is created that assesses the information provided and set the relecvant approvers.

The example I am providing below is a simple example of adding an approver to an associated review activity of a CR, where the user being set is the Assigned To user.  The PowerShell script in the workflow though could easily be updated to look at the affected CI field and then find the appropriate reviewer based on criteria you have in your environment.  This example will give you the framework to implement what you need in your environment.

Before beginning, the Service Manager Authoring Tool will be required, which can be downloaded here, http://www.microsoft.com/en-gb/download/details.aspx?id=40896.

Once the authoring tool has been installed, open it, and create a new blank management pack.  Update the filename of the new management pack to something more appropriate, and save.

New Management Pack


After the management pack is saved, right click Workflows in the Management Pack Explorer and select Create.

Create Workflow

This will launch the Create Workflow Wizard, and on the first General page, enter a useful Name and Description.



On the Trigger Condition page, select the “Run only when a database object meets specified conditions” radio button.

Next, define the trigger criteria by selecting the Change Request class, and setting the Change event to “When an object of the selected class is created”.

Trigger Criteria


Confirm all the details are correct on the Summary page, and create the workflow, and then close the wizard.  This will then open the Sequential Workflow designer, where a PowerShell script can be added to perform the actions required.

Sequential Workflow


From the Activities Toolbox, select the Windows PowerShell Script object, and drag it to inbetween the green start and red stop objects on the workflow.  Note, if you can’t see the Activities Toolbox, it can be opened from the View menu.  Once the activity is in place, it can be right-clicked and Details selected, to allow the script and properties to be added.

Script Details


Click the ellipsis button in the Script Body field to open the configuration window for both the Script Body and Script Properties.  Here is where you can input a script to do whatever you need to do.  In this demo, I used the following script, which basically loads SMLets, gets the Assigned To user, and makes the same user a reviewer in the Review Activity which is part of the Change Request workflow.

The script is placed in the Script Body field, and under Script Properties you can define data that is passed to the script.  In the script above I refer to $CR_ID which is a property that has it’s value defined in Script Properties.

Script Properties


After the script is in place, and properties configured, all the open windows can be OK’d or closed, and the management saved and sealed.  This will generate a number of files in the save location, but the only ones that are required to implement the solution into your Service Manager management group is the MP file and the DLL file. Files


The DLL file needs to be placed in the Service Manager directory on your SCSM management server that runs workflows, typically the first management server that was installed, and the Microsoft Monitoring Agent will need restarting to pick up the new MP.  The MP file needs simply importing into the SCSM management group.

After all this is complete, and given a few minutes for the MP configuration to become active, any new change requests that are created will trigger the workflow to run, so in this scenario the CR Assigned To user will automatically be added as a reviewer in the Review Activity…  Success!