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

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

  • Comments 6
  • Likes

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.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Travis: This is a common request by my user community. You mention above that you can follow the same prcoess as the incident blog post to allow the user to "un close" the CR from the console, but how do I add that "re open close CR" selection to the console if the other blog post was about adding it to the incident module. It seems like it needs to be a whole separate MP for CR closed CR re-openning? no?

  • Hi Greg -

    You just need to follow the same general pattern.  When you create the task in this case you would choose the Change Request class as the target class of the task instead of the incident class.  Then use the script above instead of the one in the incident blog post.

  • Thanks Travis... I seem to be having issues installing the SMLets feature. I followed the instructions from the Read Me Notes and no such luck. I keep getting the following error message:

    Import-Module : The specified module 'smlets' was not loaded because no valid module file was found in any module directory.

    I am getting this message when I have it installed in the Modules directory as instructed. I installed this on my local machine Modules directory. Does it need to be installed on the SCSM server Modules directory?

  • @Greg,

    Sorry for the silly question, did you remember to "unblock" the zip?

    Did you run PowerShell as admin.

    I ran into this myself and did the above and it imported.

    I imported it onto the Service Manager Server and my machine for testing purposes.

    Hope this helps.

  • Is there a way to launch a workflow created in SCSM from a task?

  • @Ryan - There is but it requires writing code and I dont have an example of that yet.