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.
- Initialize Data. Input parameter is IncidentID. ID of the incident we want to “convert” to a service request
- Get Object. Gets the incident from Service Manager. This step also verify that the incident don’t have Closed as status
- 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
- Get Relationship. Gets related Active Directory User to the incident
- Get Object. Gets the user that step 4 found
- Create Object. Creates a new service request and writes info to it from the incident
- Create Relationship. Create a relationship between between the service request and the affected user (relationship type = user)
- Create Relationship. Create a relationship between the service request and the incident (relationship class = is related to work item)
- 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
- Run .NET Script. A small PowerShell script that generates a GUID. The GUID will be used as ID for the incident comment
- 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)
- Update Object. Resolve the incident, change status to Resolved
- Run .NET Script. A small PowerShell script that generates a GUID. The GUID will be used as ID for the service request comment
- 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
- 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)
…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.