“Quick Create Incident”By
A couple of weeks ago one of my customers were asking if it was possible to get a console task that was bound to a specific incident template. They wanted to avoid the step where they have to go search/browse for the template in the “Template Picker” when creating a new incident. I came to think about the “Incident Quick Templates” solution which gives you a “fly-out-menu” of templates when you need to apply a frequently used template on an existing incident, but that solution can’t be used to create new incidents. So I went ahead and created a custom console task that solves the problem. Here it is, my “Quick Create Incident” console task.
The solution allows you to specify any number of templates you want to be able to pick from a “fly-out-menu” when creating a new incident.
Download: TechNet Gallery: Quick Create Incident
Setting up the solution
To be able to use your preferred templates in the “fly-out-menu” you need to know the internal Id of the templates you want to use.
Locate a Template ID
To locate the ID of a template, follow these steps:
- Start the “Service Manager Shell” (within the Service Manager Console go to Administration – Start PowerShell Session)
- Use the following command to locate the ID of a template (replace “incident” with any word that is part of the display name of the template you’re looking for, *=wildcard)
Get-SCSMObjectTemplate -DisplayName *Incident*|ft DisplayName,Id
- Make a note of the Id for the templates you want to have access to in the “fly-out-menu”
Wiring up your templates to the “fly-out-menu”
To add menu items (which are actually separate console tasks) wired to your templates, download the solution from here: TechNet Gallery: Quick Create Incident . Extract the zip archive to “C:\Temp\QuickCreateIncident”. Now, to define which templates you want to have access to in the “fly-out-menu”, open “C:\Temp\QuickCreateIncident\Litware.IncidentManagement.QuickCreate.Library.xml” in your favorite XML editor.
In the management pack I’ve wired-up two templates as examples to the “fly-out-menu”, the “Hardware Incident Template” and the “Network Incident Template”. Each of these menu items are defined as a <ConsoleTask> in the MP, see example below.
<ConsoleTask ID="Litware.Incident.QuickCreate.Network.Task" Accessibility="Public" Enabled="true" Target="Litware.Incident.QuickCreate.GroupTask" RequireOutput="false">
Each menu item is actually defined as separate Console Tasks that has the same Target, which is a parent Console Task. There are three important things to notice in the example above:
- The Console Task ID needs to be unique
- The Target needs to be Litware.Incident.QuickCreate.GroupTask
- The TemplateID is the reference used to define which template that will be used to create the new incident
To add your own menu items
- Copy the XML for one of the example <ConsoleTasks> (“Network” or “Hardware”)
- Give the new Console Task a new Console Task ID (which is uniqe)
- Change the TemplateId value to the Id the template you want to use (that you located using the Get-SCSMObjectTemplate command earlier)
Setting the display name of a menu item
To add a display name of a console task, follow these steps.
- Locate the Console Task ID for which Console Task you want to set the display name
- Make sure there is a <DisplayString> defined, as below, where the Console Task ID matches the ElementID
<LanguagePack ID="ENU" IsDefault="true">
- The value of the <Name> tag will be the name shown in the Service Manager console
Note: In the example above we’ve added/updated the English display string. To add display strings for other languages. See the following blog post: Localizing Management Pack Content. Also, if you delete a console task, make sure you delete the <DisplayString> as well since you will not be able to import the MP if it contains display strings that refers to deleted elements.
Setting the icon of a menu item
To specify an icon for a menu item, in the <ImageReferences> section, add a line as the example below but make sure the ElementID matches the Console Task ID of your Console Task (menu item) that you want to set the icon for.
<ImageReference ElementID="Litware.Incident.QuickCreate.Network.Task" ImageID="SMIncident!IncidentMgmt_CreateIncidentFromTemplate_16" />
To be able to use the custom Console Task you need to bundle the provided assembly file with Management Pack. Before doing this though, you should seal the Management Pack (otherwise an annoying confirmation dialog will show up each time you click one of the menu items).
- Start the “Service Manager Shell”, within the Service Manager Console go to Administration – Start PowerShell Session)
- Execute the following command:
- Execute the following command to Seal the Management Pack:
Protect-SCManagementPack -ManagementPackFile .\Litware.IncidentManagement.QuickCreate.Library.xml -KeyFilePath .\QuickCreateKey.snk -CompanyName Litware -OutputDirectory ./
- Execute the following command to bundle the sealed Management Pack with the assembly containing the custom Console Task:
New-SCManagementPackBundle -ManagementPack .\Litware.IncidentManagement.QuickCreate.Library.mp -Name Litware.IncidentManagement.QuickCreate.Library.mpb -Resource .\Litware.SCSM.QuickCreate.dll
- Finally, import the Management Pack Bundle using the console or using the following command:
You’re done! If you like the solution rate it at the gallery: TechNet Gallery: Quick Create Incident
Note: The example menu items “Hardware Incident” and the “Network Incident” are bound to out-of-the-box templates. If you’ve deleted the templates these examples are refering to since installing Service Manager these examples will not work and should be deleted. If you decide to delete them (the ConsoleTask elements), remember to delete all elements refering to them as well (display strings and image references).