Breaking All the Rules Part 2: Forcing a Change Request Status from Closed to Completed

A while back I wrote a blog post called Breaking All the Rules: Reactivating Closed Incidents.  Although all the best practices say you shouldn’t do that kind of thing, there are just some cases where you need to break the rules.  There are similar cases for Change Management.  One of them which has been raised by customers a couple of times is when you need to be able to view the files attached to a Closed change request – usually for auditing purposes.  There really is no harm in allowing somebody to view the files in a closed change request, but due to a bug we have disabled the View button on a change request when it is closed:

image

Doh!

So – until we fix this bug – the only way to view those files after the change request status has been changed to Closed is to set the status back to Completed.  When you are done looking at the files you can change the status to Closed again.

Here is a way (similar to the approach I described for incidents) that you can change the status of a Change Request.

First download the smlets CodePlex project if you haven’t already.  Reminder: this project recently went to the Beta 2 stage so please download the latest if you haven’t already.

Then you just need to run some simple PowerShell cmdlets like this:

$CRClass = Get-SCSMClass System.WorkItem.ChangeRequest$

Get-SCSMObject -Class $CRClass –filter “Id -eq ‘CR2080’” | Set-SCSMObject -Property Status -Value Completed

You can also use InProgress or Closed as the status values.

You can also create console tasks like I did for the incident example if you want to be able to have people do this action right from the console instead of in PowerShell.