Category: Class

SCSM VIP User Solution

A VIP solution is something I have been asked to incorporate in to SCSM designs by several clients in the past.

Other people have suggested solutions in the past and blogged about them. Travis Wright provided his solution here.

I have used derivations of Travis’s solution several times in the past and have continued to add to it to provide a more complete solution that not only looks good but provides simple business rules and customisable ways to identify who is and who isn’t a VIP.

This is a bit of a long post so I will try and break it in to sections.

If you don’t want to know how it all comes together, then just skip to the TechNet Gallery page and grab the Management Pack.

The Management Pack

To edit any SCSM forms or classes we have to use the System Center 2012 R2 Service Manager Authoring Tool. This tool help us create the complex XML that we need to define what a class is and how the forms should be shown. I’ll not be going in to the details of what the classes are or why we are going to do a lot of what we are doing. Others are much smarter than I at explaining these things.

Our first step will be to create a new management pack to store our new definitions in. To do this, Open the Authoring Tool and select New
9-02-2015 10-38-59 PM

Give the Management Pack a new name and save it in a location that is easy to access.
9-02-2015 10-41-07 PM

The authoring tool will now have a shiny new Management Pack for us to use. This new Management Pack has nodes for Classes, Forms and Workflows.
9-02-2015 10-41-34 PM

The Class

Next we have to find the existing class we want to edit so we can add the VIP value to the database and have it stored and usable by other components of SCSM.

From the Class Browser window, make sure that All Management Packs is selected from the drop down list to show all classes that are available.
9-02-2015 10-42-25 PM

From the list of all the classes the one we want to extend for our purpose is Domain User or Group. You can use the Search bar to search through the list or you can manually find it. Once found, we need to open it to view.
Right click the class and select View from the drop down list.
9-02-2015 11-19-26 PM

The Management Pack Explorer window should now look like this
9-02-2015 11-23-41 PM

We now need to extend this class to add the properties that we need to make our VIP solution work.
Right click on the Domain User or Group and click Extend Class from the drop down list.
9-02-2015 11-25-08 PM

As the management pack that holds the Domain User or Group class is sealed, the extension can not be saved in to it. We therefore need to tell the authoring toolkit where to save these new properties.

The currently open unsealed management packs will appear in a list and we can select the one we created earlier.
9-02-2015 10-48-29 PM

Our nice clean Management Pack now looks like this:
9-02-2015 11-26-04 PM
This extension is a way of telling SCSM that it can take the existing one from the System Library Management Pack and add these extensions to it. Any time we do this the Management Pack that contains the class we are extending must be sealed. It is not possible to extend an unsealed Management Pack.

Now that we have created an extension the this class we can define the new properties we will need.

In the main working window, click the Create Property button.

9-02-2015 10-50-11 PM

The create property window will appear and ask for an Internal Name. The internal name is how the code will reference this new property and as such can not have any spaces. Enter a new name for the property, like this:

9-02-2015 10-50-24 PM

In the Details pane the new property should now appear.

Click the new property to select it

9-02-2015 10-51-07 PM

Properties can contain different types of data. For example: a property of First Name would need to contain a string of characters that are alpha numeric, but a property of Phone Number might contain just numbers. We can also assign a Date Time data type to store specific date or time formats and we can store True\False answers in a data type called Boolean.

As we just want to show if a user is a VIP or Not a VIP we can use the Boolean data type to show Yes\No or True\False. With the new property selected, in the properties pane change the type to Boolean.

9-02-2015 10-51-55 PM

That’s it!

The Domain User or Group class now has a new property that can record True or False answers for if a user is a VIP.

The next question is how do we see this property within the SCSM console and allow Analysts to set a user as a VIP. To do this we have to edit the forms….

The User Form

Just like the class property that we just created, form designs and layouts are saved in XML format. It is possible to edit the forms from and XML or text editor but this task is very difficult and does not show us the results in a live preview.

Instead we can use the SCSM Authoring Tool to edit the form in a graphical user interface so we can make the changes to the form in a WYSIWYG editor to know exactly what we are going to get from our end product.

There are two (2) forms that we need to edit. The first is the User CI form to allow analysts to be able to select a user as a VIP and second the Incident form to display if the user is a VIP or not. (We could then also edit any form that the Affected User field appears on, but to make this blog shorter we will only focus on the Incident form)

First we need to select the form we wish to add to, in our case the User CI form.

From the class browser pane we need to first select the Form Browser tab at that bottom of the pane. This then shows us all the forms we have to choose from.

9-02-2015 10-46-03 PM

With such a huge list it is easier to search for the form we want, so select the search text box and type “User” to look for any forms that are related to the user.

9-02-2015 10-46-35 PM

As you can see there is only one form that relates to the user.

Right click the User Form and select View from the drop down menu. This opens the form from the sealed management pack for us to view only and the Management Pack Explorer should look like this:

9-02-2015 10-47-08 PM

In the main editing pane we should also see the User CI form. This will be greyed out as it is just showing us what the form looks like to make sure we have the right one.

To edit this form click the Customize button.

9-02-2015 10-53-16 PM

Again, like with the user class, the customisations can not be saved in the sealed management pack that the form is currently in. So we have to select the unsealed management pack we created earlier.

9-02-2015 10-53-32 PM

Our management pack will now have a customised User Form in the list and the form browser is no longer greyed out so we can now make edits to it.

9-02-2015 10-54-01 PM

Many SCSM forms work on the idea of Panels that divide the form up to general areas to keep controls of like types together. One of the big problems that people have when editing forms is not being able to get to the panels as they are covered by controls that are set to stretch to fill the panel.

A way to get around this is to set a margin on one of the controls (Such as a label) so we can select the panel behind the controls.

In this case, if we select the “Display As” label we can set the Top margin to a higher value.

9-02-2015 10-58-49 PM

To set the margin, select the Details pane and manually enter a value for the TOP property in the Margin heading. Like this:

9-02-2015 10-59-12 PM

The form will then adjust to the new value and look like this:

9-02-2015 10-59-43 PM

To make it all look even we can then select the “User Name” label and set the same value for it’s top margin.

9-02-2015 11-00-03 PM

Now that we have made some room for our new VIP control we can add the check box we will use to display the VIP value.

Within the Authoring Toolkit windows there is a Form Customization Toolbox pane that contains all the type of controls we can add to a form. For our purposes we want to display just a check box to the analyst to display if the user is a VIP or not.

9-02-2015 11-00-20 PM

From the Toolbox Pane, click and drag the Check Box control on to the form just above the Display As label.

The area around the Display As and the User Name boxes will be highlighted when you are over the top of the Panel that these controls use. Release the left mouse button when the form looks like this:

9-02-2015 11-00-46 PM

As you can see it will drop the new check box in the stack panel but may not be exactly where we want it.

9-02-2015 11-01-16 PM

To adjust the location of the control it is best to allow the form rendering to be as automatic as possible. To allow this, we need to set as many properties to auto as we can.

Within the properties pane we can set the Top, Bottom, Left and Right margin settings all to 0. This will allow the stack panel to manipulate the control in line will all the other controls.

The other settings that will be set to default are the Height, Width, Maximum Height, Maximum Width, Vertical Alignment and Horizontal Alignment settings. You will start to get an idea on how these settings work in the form designer over time but for now the settings used on this form are:

Setting Value
Top Margin 0
Bottom Margin 0
Left Margin 0
Right Margin 0
Height Auto
Width Auto
Minimum Height 0
Minimum Width 0
Vertical Alignment Center
Horizontal Alignment Left

9-02-2015 11-01-31 PM

Those settings give us a check box control that looks like this:

9-02-2015 11-01-57 PM

Within the details pane we can also set the label of the control to a value that will display to the analyst on the form. In this case VIP.

9-02-2015 11-02-36 PM

We now have to link the control to a property in the Domain User or Group class. This will be the new property that we created earlier VIP.

In the details pane select Binding Path and then select VIP from the list of class properties.

9-02-2015 11-27-29 PM

The user form is now complete.
It should look like this:

9-02-2015 11-46-05 PM
(This is a screen shot of the finished product in SCSM so don’t get concerned about the exact look at this time, just the layout)

The Incident Form

The second form that we need to edit is the Incident form. We want to add a check box to display if the user is a VIP or not.

Like our previous edit we need to select the form we wish to add to, in this case the Incident form.

From the class browser pane we need to first select the Form Browser tab at that bottom of the pane. This then shows us all the forms we have to choose from.
If we type “Incident” in to the search field it reduces the number of items to a manageable level.

Right click on System.WorkItem.Incident.ConsoleForm and select View

9-02-2015 11-28-30 PM

Click Customize to make edits to this default form

9-02-2015 11-29-20 PM

Again, any edits to a form must be stored in a management pack that we can write to (Unsealed) so we are asked what management pack we want to save it to.
Select the VIP management pack that we are editing and click OK

9-02-2015 11-29-29 PM

On the Incident form the controls are laid out using what are are called Stack Panels.

Many SCSM forms work on the idea of Stack Panels that pretty much do as their name implies and “Stack” controls on top of each other.

In short the Stack Panel is a simple layout panel that automatically stacks elements within it below or beside each other, depending on its orientation. This makes creating any type of list or stacked controls very easy. All controls like Combo Box, List Box, Label, Text Box etc. can use a Stack Panel to organise their layout.

Like the panels in the previous form one of the big problems that people have when editing forms is not being able to get to the panels as they are covered by controls that are set to stretch to fill the panel.

A way to get around this is to set a margin on one of the controls (Such as a label) so we can select the panel behind the controls.

In this case, if we select the “Affected User” label we can set the Top margin to a higher value.

9-02-2015 11-30-30 PM

In this case I set the top margin to 25

9-02-2015 11-30-49 PM

As you can see we can then click on the white space just above the label and that allows us to select the Stack Panel so we can drag and drop new controls in to it.

9-02-2015 11-31-24 PM

You know you have selected the Stack Panel by looking at the top of the details pane. This can be useful as there is often many layers of panels or grouping boxes that may be involved with form design.

9-02-2015 11-31-37 PM

Now that the Stack Panel is exposed, click and drag a check box control to the Stack Panel.

9-02-2015 11-31-53 PM

You will then be able to click and drag the check box control within the Stack Panel and the Affected user label and user picker controls will automatically move up or down to make room for it. This is why Stack Panels are so useful.

9-02-2015 11-32-27 PM

Now we need to assign details to the check box.

 

Property Value
Top Margin 0
Left Margin 0
Right Margin 0
Bottom Margin 0
Label Content VIP
Is Enabled False
Binding Path Affected User.VIP

9-02-2015 11-33-15 PM

We want the Check Box to show but not for analysts to uncheck when creating an Incident. If you want analysts to be able to make that choice when they are creating an Incident, leave IsEnabled set to True.

9-02-2015 11-34-33 PM

Set the Binding Path to Affected User.VIP. This is the property we created earlier.
Unfortunately, you can not browse for this value as it will not appear in the authoring toolkit so the value will just have to typed in manually.
(you can get more informaiton on this issue here: https://blogs.technet.microsoft.com/servicemanager/2012/05/25/how-to-display-user-class-extended-properties-on-incident-form/)

9-02-2015 11-38-55 PM

The extension is now finished and can be saved and the Authoring Tool closed.

Before we go sealing the management pack for it is used in the SCSM environment, there is one more manual step that must be taken to make this solution work.

Again, an issue with the Authoring Toolkit is that it shows and records the Binding Path as the friendly name of the class extension “Affected User.VIP” but the XML must contain the Internal Name. In this case the only difference is the space between Affected and User.

To do this, open the saved XML management pack in your favorite editor of choice (Notepad++ is my favorite) and search for “Affected User” Anywhere you find this reference, change it to “AffectedUser” (No spaces)

XML Edit

Save the XML and move on to sealing the Management Pack.

Sealing The Management Pack

As described by TechNet:

There are two types of management packs:

  • Sealed management packs: A sealed management pack (.mp file) cannot be modified.
  • Unsealed management packs: An unsealed management pack (.xml file) can be modified.

Other than lists and forms, objects such as views that are defined in a sealed management pack cannot be customized. Customizing a list that is defined in a sealed management pack includes adding list items. Customizing a form that is defined in a sealed management pack includes adding fields.

You cannot unseal a management pack that is sealed. To modify objects that are stored in a management pack that you have already sealed, you can modify the original unsealed management pack file from which the sealed management pack was created. Alternatively, you can import the sealed management pack, and export it to a new unsealed management pack, that can be modified. After you import a sealed management pack, you cannot import the unsealed version of the same management pack until you delete the sealed version.

There are two (2) ways to seal a Management Pack.

  • Using the Fast Seal (There is a great blog on this by Rob Ford of SCSMNZ.Net)
  • Using the Authoring Toolkit (As described on TechNet)

For this blog I am going to use the Authoring toolkit.

To seal the Management Pack, click the File menu and select Seal Management Pack

9-02-2015 11-41-35 PM

Enter the output directory where the MP will be saved
Enter the Key File that you have to sign the MP.
(Check out this MSDN article on how to create a Key Pair if you don’t already have one)
Enter a Company Name

Click Seal

9-02-2015 11-41-55 PM

Now you’ve got an MP the only thing left to do is import it!

9-02-2015 11-45-55 PM

The Result

After restarting your SCSM console session you should now see the new VIP check box on the Incident form.

9-02-2015 11-46-55 PM

And if you open a User CI you should also see the VIP check box.

9-02-2015 11-46-05 PM

To test, select a user as a VIP and create a new Incident for them. The VIP check Box should appear checked on the Incident form.

What you do with this knowledge is up to you.