In part 1, I provided some instruction and code on how to create a custom control to place onto the incident form to disable controls when resolved or closed.
In part 2, I will show you how to add this control to your incident form.
You’ll need to use the Authoring Tool, which is a separate download and install. If you’ve not used this tool before, it can be a little fiddly but the changes you need to make are small. You’ll also need an XML editor, this can be Notepad but something like Visual Studio is much better.
As usual, please make changes on a test or dev system first.
I am assuming to start off that you have not yet customised your incident form. If you have, you just need to add the “AddControl” and “Resource” parts to your already existing MP.
Start the Authoring Tool and create a new Management Pack with a name like “IncidentCustomForm”. The filename of your MP must match the internal ID so don’t leave it as the default.
Click “View\Form Browser”, select “All Management Packs” and enter “incident”:
Right-click “System.WorkItem.Incident.ConsoleForm” and select “View”. The form will open, click “Customize”:
Click OK to save the customisations in the current Management Pack:
Now, click and drag a new label to the form somewhere under “[AssignedTo]:”. Doing this can be fiddly – it is best to click on the control icon, wait a moment and then slowly start to drag and carefully drop here:
So your label looks like this:
Note the label name – “Label1″ and save your Management Pack and exit the Authoring Tool.
Open IncidentCustomForm.xml in your XML editor and scroll to this section:
Note the highlights, here is your label and the parent control it belongs to.
Replace this entire Customization block with this (change parent if needed):
<Customization> <AddControl Parent="UpperGeneralGrid" Assembly="DisableFormControl" Type="DisableForm.DisableFormControl" Left="49.5" Top="458" Right="0" Bottom="0" Row="0" Column="0" /> </Customization>
And add a reference for the assembly at the end like this:
<Resources> <Assembly ID="DisableFormControl" Accessibility="Public" QualifiedName="DisableFormControl" FileName="DisableFormControl.dll" /> </Resources> </ManagementPack>
Save your changes. You now need to seal your Management Pack, details can be found here.
Next you need to bundle your Management Pack with the dll. To do this, you can use the 2012 Powershell command New-SCSMManagementPackBundle or, still my preferred way, the old New-MPBFile.ps1, details of which can found here.
Import the .mpb into Service Manager. Please do this on a test or dev system first. Sometimes, making form changes can crash the console or have unexpected results.
Now, when you start the console and open a resolved or closed incident, the controls will be disabled or (read-only for text-boxes) and the OK and Cancel buttons will be disabled: