How to change status on Service Request templates (or other templates)

 

As google didn’t help I decided to make a small how-to guide on how to modify the status on a template that can’t be done in the console. I’ll use a Service Request template as example here, but it’s the same method for other templates as well.

1. Introduction

 

When editting a service request template in the console you’re presented with this:

ServiceRequestTemplate1

Unlike the Incident template form there is no option to change the status. Either if you want some of the default ones (Cancelled, Completed, Closed etc.) or if you added your own Status in the enumeration list (e.g. Pending User).

This is how I did it with a bit of Management Pack XML editting and powershell:

2. Step-by-step guide

 

1) Add your own Status (optional)

Add some new Status values in the Service Request Status enumeration List (skip this step if you just want to use the standard statuses). I’ve added Pending User and Pending External

image

2) Create template

Create a new Service Request template and change atleast one list property, e.g. change Source to Portal. This is required to save the template, but also to add the right reference in the MP that we need to use. You can always delete this property in the MP again.

3) Save and export

Export the Management Pack where you saved the template and open it.

4) Locate your template in the XML

Now we need to update the Service Request template with the right property. Locate your template in the xml file. It should look something like this:

If you have alot of templates in the MP you can always search for the name, e.g. “Service Request – Pending User” or whatever you named your template. This will take you to the end of the xml file where the DisplayString is located. Now copy and search for the elementID (e.g. Template.ad71c64135a343a7b376bb9f2e820351) and it will (eventually) get you up to the correct location.

5) Add the Status property code

Adding a standard Status:

Right under <ObjectTemplate ID insert the <Property  …. </Property> code like this:

 

Here I’ve added the Status Closed. You can replace Closed with other standard Status codes for Service Request:  Submitted, Completed, Cancelled, InProgress, OnHold. E.g. $MPElement[Name=’ServiceRequest!ServiceRequestStatusEnum.OnHold’]$

Delete redundant properties if needed.

Adding your own Status:

Adding your own Status code is a bit more tricky because its internal name is created as a random ID number (e.g. Enum.97f8882db09f4553a26086bdd92754bb). The custom value do have a unique ID to be used though (GUID). We can use the powershell cmdlet Get-SCSMEnumeration to retrieve this (requires smlets: http://smlets.codeplex.com/):

Open a new powershell window and type in the following:

  • Import-Module smlets
  • Get-SCSMEnumeration | ?{$_.Displayname -like “Pending External”}  #<—This will return all Enumeration values named “Pending External”. Replace it with your own name of course.
  • Put it in a variable:
  • $temp = Get-SCSMEnumeration | ?{$_.Displayname -like “Pending External”}
  • Output the ID:
  • $temp.ID > C:\temp\temp.txt  #<–make sure path exists
  • NB! If there was more than one enumeration value returned the txt will be blank. In this case select the array number your enumeration value was listed from the previous output:
  • $temp[0].ID > C:\temp\temp.txt #([0] if it was the first on the list [1] second etc.. You get the idea : ))

When you got the right GUID, simply replace the $MPElement[Name=’ServiceRequest!ServiceRequestStatusEnum.OnHold’]$ with the guid. So it looks like this:

 

6) Save and import

That’s it! Save and Import the Management Pack. If everything went well, your template should have a changed status when you open it in the console:

template2

Please comment if you get any errors or if you figured out how to do this in a smarter way via powershell: )

By | 2013-02-04T20:33:18+00:00 February 4th, 2013|Service Manager (SCSM)|13 Comments

About the Author:

Morten Meisler

Consultant / Developer / Trainer

Key areas / products:

  • System Center Service Manager
  • System Center Operations Manager
  • Automation (System Center Orchestrator / Service Management Automation (SMA))
  • Development: C#.Net, Powershell, SQL, Web development / HTML5 (Javascript,jQuery,CSS,HTML, Wordpress etc.)

13 Comments

  1. Overnight Reputation May 2, 2013 at 19:36 - Reply

    The other day, while I was at work, my cousin stole my apple ipad and tested to see if it can survive a thirty foot drop, just so
    she can be a youtube sensation. My iPad is now destroyed and she has 83 views.
    I know this is entirely off topic but I had to share it with
    someone!

  2. tabdighurtigt.com May 18, 2013 at 13:02 - Reply

    tabdighurtigt.com…

    Coretech Blog » Blog Archive » How to change status on Service Request templates (or other templates)…

  3. Anvaj July 9, 2014 at 15:17 - Reply

    I have tried this. but when I try to import the management pack, I get the error .

    Status is not a valid property. Any suggestions

  4. Morten July 10, 2014 at 14:03 - Reply

    Hi Anvaj,
    I cant test it right now, it could be some incongruence with the alias..but you can just replace the property with the guid of the status you need.

    Let me know if it works or you need more help with finding the guid

  5. Joel September 9, 2014 at 14:51 - Reply

    When I run Get-SCSMEnumeration | ?{$_.Displayname -like “Pending External”}, there is no output after I’ve added my custom status to the List Properties for Activity Status. Is there something I’m missing?

  6. Morten September 9, 2014 at 15:17 - Reply

    Hi Joel,

    You should replace “Pending External” with the display name of your custom list item. Be also aware that if you copy-paste the code from here, some of the symbols could be wrong, e.g. “”. You actually don’t have to output it to a txtfile, just format-table and select only displayname and id, like this:

    Get-SCSMEnumeration | ?{$_.Displayname -like “Pending External”} | ft DisplayName, id

    Let me know if it works

  7. Manoj Khurana June 18, 2015 at 16:25 - Reply

    Hi Morten,

    We tried this option and were able to chnage the status of the service request but how can now status of SRs be changed – All statues are grey out now.

  8. Pam Moore May 16, 2016 at 20:52 - Reply

    were can I get this template from?

  9. John October 11, 2016 at 15:46 - Reply

    Hello Morten,

    Thank you for the solution!

    I’ve implemented at work – where I set the status to “complete” for SRs.

    I have an issue where the SLA will continue, as there is no competition date for the work item.

    Are you able to help or point me in the right direction?

    • Morten Meisler October 21, 2016 at 14:02 - Reply

      Hi John,

      Sorry for the late response. Regarding the Completed Date, then yes, that needs to be set before applying the template, otherwise it will be either null (or in some cases, e.g. for Incident, be a specific old static date). Unfortunately, you cannot do a [now] or similar in the template xml.

      When and how are you applying the template? If it’s a normal SCSM Workflow it will be difficult to set the Completed Date, unless you don’t care about reporting you could set it to a static future date (like 2020) so it won’t mess up the SLA. If it’s via Powershell or Orchestrator (or other place), you should be able to set the Completed Date before applying the template.

      Also, this is an old post, today I would advice against making new status values on the out-of-the-box status list for SR. Instead make a new custom status enumeration list, but since you are using an out-of-the-box status value – completed, it doesn’t matter.

  10. Rabbany May 7, 2017 at 20:32 - Reply

    Hi can you publish a video tutorial that can help me better.

    • Morten Meisler May 7, 2017 at 20:43 - Reply

      Hi Rabbany,

      No sorry, this blogpost is pretty old and as I wrote in my previous comment I advice against setting the build-in status. If you want to make custom statuses, you should make your own custom status enumeration list, and then still follow this guide to set that one.

  11. discover this info here September 11, 2017 at 17:56 - Reply

    … [Trackback]

    […] Find More on|Find More|Find More Informations here|Here you can find 39507 more Informations|Informations to that Topic: blog.ctglobalservices.com/service-manager-scsm/mme/how-to-change-status-on-service-request-templates-or-other-templates/ [……

Leave A Comment