Creating SCSM Work Items from Template with Prefixes!
In a previous post I showed how you can create a Service Manager Work Item from a template in Orchestrator by using the SDK. The reason you would want to do this, is so you can include the prefixes on the Work Item and its child activities. This is something the Service Manager integration pack does not handle well, especially with regard to the child activities. However, there was one major drawback to the method I showed. It does not work for activities that are inside of parallel or sequential activities. This is due to way that the Run .Net Script activity behaves in Orchestrator.
So to get around this, I have written a light weight executable that you can pass a template ID to. It will create a new Work Item, and assign prefixes and proper display names to all child activities. The reason I made it an executable, is to allow you to run it in Orchestrator using the Run Program activity, call it from a Scheduled Task, run it from a custom Task in the console, or even call it from a PowerShell script. This executable will work for Change, Incident, Service Request, Release, and Problem templates.
To run the executable, you need to provide the template’s Guid and optionally the name of your Service Manager management server. The executable will output the Guid of the Work Item it created, so that you can perform other tasks on it afterwards.
You can download the executable or the entire source code on HERE on GitHub.
As I mentioned earlier in the post, you can run this executable using the Run Program activity in Orchestrator. To do this, select “Command execution” for the mode, and add the path to the executable along with the parameters.
After the activity runs you can select the Pure Output from the Published Data returned. This will be the Guid Id of the Work Item it just created. You can use this with other activities like the Update Object activity to make additional changes.
Keep in mind this executable is a work in progress, and has only been tested in the handful of environments I have. Please feel free to let me know of any issues or recommendations you may have.