www.contoso.se

Cloud and Datacenter Management by Anders Bengtsson

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.

 

« »

© 2019 www.contoso.se. Theme by Anders Norén.