Home » Orchestrator » Convert a incident to a service request, with a bit of Orchestrator magic

Convert a incident to a service request, with a bit of Orchestrator magic

A couple of days ago there was a question about converting a incident in Service Manager to a service request. The scenario was around a support call first register as an incident, but later the operator finds out it should be a service request. Out of the box in Service Manager there is no tool to move the data we have already input in the incident over to a new service request. But of course we could use Orchestrator to do it 🙂 We could also build this workflow as an internal workflow in Service Manager… but that would take me a lot of hours; this runbook only took two cups of coffee. In this post I will show a idea how to build a task that you can run against a incident in Service Manager to “convert” it into a service request. The incident is not really converted, we copy the info we have in the incident over to a new service request, link them together and close the incident.

The runbook is trigger by a task in Service Manager, input parameter is only the incident ID.

 

 

 

  1. Initialize Data. Input parameter is IncidentID. ID of the incident we want to “convert” to a service request
  2. Get Object. Gets the incident from Service Manager. This step also verify that the incident don’t have Closed as status
  3. Send Platform Event. If the incident is closed or cant be found a platform event is generated. For example if you trigger the runbook with a incorrect incident ID from the Orchestrator console it will not run
  4. Get Relationship. Gets related Active Directory User to the incident
  5. Get Object. Gets the user that step 4 found
  6. Create Object. Creates a new service request and writes info to it from the incident
  7. Create Relationship. Create a relationship between between the service request and the affected user (relationship type = user)
  8. Create Relationship. Create a relationship between the service request and the incident (relationship class = is related to work item)
  9. Format Date/Time. Gets the current time stamp in a correct format, will be used when creating comments on the incident and the service request
  10. Run .NET Script. A small PowerShell script that generates a GUID. The GUID will be used as ID for the incident comment
  11. Create Related Object. Creates a Trouble Ticket Action Log (action log comment) on and relates it to the incident. The runbook writes a comment saying the incident has been converted to a service request (relationship type = Trouble Ticket Has Action Log)
  12. Update Object. Resolve the incident, change status to Resolved
  13. Run .NET Script. A small PowerShell script that generates a GUID. The GUID will be used as ID for the service request comment
  14. Create Related Object. Creates a Trouble Ticket Analyst Comments (log comment) and relates it to the service request. The runbook writes a comment saying the service request was based on the incident
  15. Send Platform Event. Writes a platform event with service request ID and incident ID

That is the runbook, the next component is the task in Service Manager. We could trigger the runbook from Orchestrator console and input the incident ID manually, but it is easier with a task in Service Manager. In the Service Manager console, in the Library workspace you can create a new task with the following settings.

  • General/Task name: Contoso - Convert Incident to Service Request
  • General/Target class: Incident
  • Categories/Categories: Incident Management Folder Tasks and Incident Support Groups Folder Tasks
  • Command Line/Full path to command: C:\TEMP\ORT251\ORTRunbookLauncherCLI.exe
  • Command Line/Parameters: /IncidentID=$Context/Property[Type=’WorkItem!System.WorkItem’]/Id$
    (the parameter is the work item ID that you can insert from the  “Insert Property” button)
As you can see I use ORTRunbookLauncherCLI.exe to start the runbook. ORTRunbookLauncher.exe is part of Orchestrator Remote Tool that you can download from Codeplex. These tools provide a way to launch Orchestrator runbooks remotely from a UI or a command-line. Note that before you can run ORTRunbookLauncherCLI.exe you need to run ORTUIGenerator to generate a config (XML) file for the runbook you want to trigger. Lets look at a example
We select a incident and click the “Contoso – Convert incident to Service Request” task
…the task starts and as we can see the task forward the incident ID to the runbook and starts the runbook

…the runbook runs and generates a platform event

…if we look at the incident it is now resolved and has a new comment

…also a relationship to the new service request

…and when look at the service request we can see that data has been copied over from the incident

Summary: We have built a task in Service Manager that use the Orchestrator Remote Tool to trigger a runbook. The runbook connects to Service Manager, copies the data we have in the incident over to a new service request, resolve the incident and update both incident and service request with relationships and comments.

You can download my runbook example here, 20120410_Incident2ServiceReq_WOLF.  Please note that this is provided “as is” with no warranties at all.

 


48 Comments

  1. Hi Anders

    Great guide

    I cant figure out what im doing wrong.

    Instead of incident number i get :

    IncidentID : Any string value is allowed

    Argument parsing
    —————————
    IncidentID was found with a value of $Context/Property[Type

    Here is the parameters:

    /IncidentID=$Context/Property[Type=’CustomSystem_WorkItem_Library!System.WorkItem’]/Id$

    I don’t know if its the ‘ because if i create a task with copy paste from your guide it wont create it before i change your ’ to ‘

    Best Regards
    Martin

  2. Hi,
    You have to look at the execution of each activity and see what activity return more than one object. As soon as one activity returns more than one answer/object the rest of the runbook will run in multiple threads, for example create multiple multiple service requests. Try add logging to each activity and see how they behave.

  3. Hi Anders,

    great stuff… b u t it runs the CreateIncident and CreateRelationShip at least twice so we receive 3 Service Requests out of 1 Incident !?!! :-/

    Any idea why this happens?

    Thanks, Markus

  4. Hi everybody,
    It’s a really good post! I used to implement the solution but finally my mgmt made me deploy SCUtils Convert task that the users like more. However, I really appriciate Ander’s work.
    Good luck,
    Alex

  5. Hi Andres, many thanks for this solution! I have added to it to create a Manual Activity too. However, is there a way to link a Manual Activity to a Service Request using a Runbook? Also do you by any chance have a newer version of the Runbook on this page which integrates the transfer of attachments? I’m struggling to follow your other article on attachments (http://contoso.se/blog/?p=3227) to get it to work along side this Runbook. Many thanks for any help you can give, Greg

  6. Hi, have you checked system local settings on both machines? Make sure they are the same, US local settings. Sounds like it could not convert CLOSED to a list value.

  7. Anders,
    Is there any way to grab the attached files from the IR and attach to the new SR on runbook? This has been very beneficial to our environment. Great Work!

    Thanks
    Brandon

  8. Hi Anders, This is a great runbook and I’ve have it almost finished. The 3 obstacles are getting the service request Urgency and Priority “copied over from the incidents. Since these fields are using different enumeration lists, they aren’t carried over like the other fields. Is this something that can be done and if so, how. Thanks. Pat

  9. Convert a incident to a service request, with a bit of Orchestrator magic>

    I created the above Runbook and it works fine and can be started from Orchestrator console giving the incident ID manually and also as a Task from the Service Manager Console.

    But when I check the Service Request, just created, I see 2 and sometimes 3 SR with the same content.

    Anyone of you had this problem? Any idea?

    Thanks in advance
    Rohan

  10. Hello Anders,

    We have some problems with the date/format that is written to the action log, for example the actual date is 23/07/2013 but the date written to the action log is 7/11/2014.
    Do you have any idea how i can fix this problem.

    regards

    Geert

  11. Hey Anders,
    We implemented the runbook in our environment and one thing we noticed is that once the SR is created, you cannot search for it through the Thick Client.
    Any idea?

  12. Hi

    Great post.
    I’m getting the run book to work when i’m running it from the Orchestrator server, but when i’m running it form the SCSM Console it starts and the log says “successfull”, but the run book gives me “cannot find a managmentpackenumeration [closed] on the Get Incident object. . The scsm managment pack is the latest version and the language is set to USE on both servers.
    Any ideas?

    Rgds
    Atle

  13. I have this task in place and is working great overall. One thing that I have noticed is that when the Incident is Resolved, the Related SLAs do not get cancelled as they do when you manually resolved an Incident. I end up getting SLA breach notifications on Incidents that have been resolved and a related Service Request created using this task. Is there a guide on removing or cancelling the Related SLA when resolving the Incident through Orchestrator?

  14. Hello Anders,

    I wanted to see if you could explain how to get the orchestrator runbook tool to run without having to use an elevated command prompt. I can run the CLI exe all the time successfully, however when I create the task in Service Manager I cannot get it to see the template.xml file. It happens the same if I run the command from an unelevated cmd.

    Thoughts?

    Very happy with this work. Thanks again!

  15. Hi Anders,

    I had last year the Problem that all converted SR were still in Status pendig and the Close button was greyed out. It seems that I have fixed now the Problem..;-)
    I have added to the “create Service Request” activity Status=new. And now it works perfectly.
    Probably helpfully for other users witjh the same Problem..;-)

    M.

  16. THis runbook only add affected user i want to add IR assigned to USER in SR

    how to do this ….this is urgent …..need your help please

  17. I also want to add assigned to user and all incidents comments please help how to do this

  18. Hi Anders,

    That is a great runbook. Thank you so much.

    all things great but when i add remote tool to scsm 2012 as a task, i get an error. But its working great on ORTrunbookLouncher.exe.

    When i link ORTeunbookloncherCLI.exe to incident as a converter link. i am geting this error;

    Execution mode: Standart
    There is no runbook template file in the folder, please use the UI Generator to create such a file and try your command line again. The XML template that was tried was : policy_template.xml

    i was already created policy_template.xml from ORTUIGenerator.exe. But i didnt resolve that issue. DO you have any idea?

    Regards.

    Firat

  19. Hi Anders,
    After reading through this, I am very curious how to do what you suggest below. I want to create an SR from a ticketing system. The SR is alredy setup as a request offering. I want to use that offering as it has the user input setup like I want. I have the template configured to create the activities I need as well. Howcan I do this?
    Thanks!

    “When we apply a template we copy all the settings from the template to the work item. After that there is no relationship between the two. If you want to do that with Orchestrator you need to manually read the template and write all the settings to the work item. Except for incidents I think, don’t have the Orchestrator console in front of me but I believe there is a activity that generate incidents from a template.”

  20. hi All,

    regarding the handling of the Prefix of the new created SR…
    Well, I have added the Field ID in the “Create Service Request Action” with this value
    SR{0}
    This works fine for me.
    The only problem that I have now is, that I cannt close the service request. It stucks in Status “in Progress”. Complete and closed are greyed out.

    Markus

  21. Hi Andres,

    Back to the Problem to apply a template..;-)
    Weill I saw in the “create Service Request Action” a Parameter like Template ID. Guess this can be used to select a template?? But I Don’t know how/where I can see the template ID. It is not the Workitem ID. Think it makes sense to use a predefined Template with some Actions inside or to use a Auto assign to a technican with a template…
    The next problem is, that the created Service Request cannot closed on our SCSM and won’t be also closed automaticly. Any idea what this can be??

    THX

    Markus

  22. Hi, see if you can enable more loggning in the SCO remote tool. Verify that you can access the Orchestrator web service with that account. See if the command works local on the SCO server if you move the files over there.

  23. Thanks Anders! A much better explanation than http://technet.microsoft.com/en-us/library/hh832007

    I’m attemping to update the request action log when the service request calls a runbook in SCO. When a particular activity in the runbook finishes is would be nice to update that log. Like “Server X compliant” after my patching is done. That way the requester can see it in the logs.

    Thanks again,

    Brett

  24. Hi, so Service Manager includes a mechanics to handle “ID”, it is the same for all work items, that is why two incidents to get numbers sequence always even if they are created seconds after each other. When you create work items with Orchestrator, Orchestrator don’t add the IR or SR before that ID, so the only ID you get is the sequence number. I guess you could re-build your runbook to handle this too. I don’t think there is a example at the blog, sorry.

  25. …also, if you create a service request, with no activities, it will be completed automatically soon after created, as all the activities are done. Just give it a couple of minutes.

  26. Hi, thanks! When we apply a template we copy all the settings from the template to the work item. After that there is no relationship between the two. If you want to do that with Orchestrator you need to manually read the template and write all the settings to the work item. Except for incidents I think, don’t have the Orchestrator console in front of me but I believe there is a activity that generate incidents from a template.

  27. Anders,

    Thanks for the post. Can you give an example of the short script you used to generate the guid? I’m trying to use an example from Technet but I get an error saying that the character is not valid and identifier expected.

    Thanks for the help.
    Brett

  28. Hi Anders,

    Really a great guide !!!!
    But I have some minor problems.
    1. When the Service Request is created, there is no chance to complete it. Its stucks in status Progress. Think it has something to do with the used Template. Is it possible to do a definition of the used template on the “create Service Request” action?

    Thanks

    M.

  29. Hello Anders,

    After struggling a bit with Orchestrator (never used it before). I succesfully reversed this method. Now that i understand a bit more of Orchestrator everything makes a bit more sense!

    Allthough i have one question about this method. When i convert a Service Request to an incident or an Incident to a service request the TicketID for the converted work item shows in my console as “2000” while the original work item is “SR/IR2000”.

    I think this might give some errors when we use [IR2000] to update an incident by e-mail with the Exchange connector 3.0. Is there any way to make sure an converted incident gets IR in the ID and vice versa for the Service Request?

    Regards,

    Dave

  30. Hi Dave, thanks for reading my blog. Yes, you can do the other way around too. As we have access to all objects and we can create all kind of objects, we can do what ever we want to in Service Manager with a runbook. The question is to map the properties, which properties from a service request do you want to write at what properties in a incident. When you know that you can copy this runbook and just replace the create object activities.

  31. Hello Anders,

    First of all thank you for your great guides!

    Is the other way around converting a Service Request into a Incident almost the same as this or are there some differences i should pay attention to?

    Regards,

    Dave

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.