A while ago I have written an article about customizing Service Manager to make it customer-aware. This was just a simple example of how to assign incidents to different customers. Because this article was (and still is) very popular, I decided to write another one about customer-awareness. In this post I will show you how you can assign Configuration Items to customers which can be very important when you manage objects for several customers and different environments. I will show an example of assigning Windows Computer objects, but this can of course also be done with any CI Type.
First of all I have to create a new Management Pack and a new class that will store information about customers. I do this by using the Authoring Tool, create a new class and define some properties I need. For this example, I just defined two attributes, the Customer ID and the Customer Name, where the Customer ID is an autoincrementing key property. For a production environment, you can add more attributes as needed.
For more details about creating classes and attributes see this article –> http://blog.scsmfaq.ch/2011/01/24/make-service-manager-customer-aware/
For more details about automatically incrementing property values see this article –> http://blog.scsmfaq.ch/2011/06/04/autoincrement-property-ids/
Now, I have to create a new Relationship between the Customer Class and the Windows Computer class because I want to assign the Windows Computers to customers.
I call the new relationship “WindowsComputerBelongsToCustomer” and do some editing afterwards. I change the name to make it better readable and configure the relationship source and target – the source is the customer class, the target must be changed to “Windows Computer”. Because at the end a customer can own multiple Windows Computers, but a Windows Computer can only belong to one single customer, I have to change the cardinality (many-to-1/0).
Now as the data model is ready, I need to present the information on a form. Because we are talking about Windows Computers, the form “ComputerForm” has to be customized. The form can be found in the form browser of the Authoring Tool. Because this form is stored in a sealed Management Pack, an unsealed Management Pack must be chosen to save the customizations.
1. Search the form in the form browser.
2. View the form and customize it.
3. Select a Management Pack to store the form customizations.
Important: In this example I store classes, attributes and form customizations in the same Management Pack. For a production environment I would make more sense to separate the data model from the presentation layer. But this means that the Management Packs (at least one) has to be sealed because referencing to an unsealed Management Pack is not allowed.
Now, as I am able to change the Computer form, I have to put an Instance Picker to the form. I do this by adding an additional tab to the form and then place the control there. This is the easiest way to go because I don’t have to deal a lot with formating. Of course, it’s also possible to place the picker somewhere else.
1. Drag the “Tab Item” Control to the form. Make sure that the panel is marked before.
2. Show the details of the tab.
3. Change the color (not really needed) and content of the tab.
4. Switch over to the new tab, add a label and a single instance picker control.
5. Edit the label to change the content.
6. Edit the picker to change the data binding to the relationship property “WindowsComputerBelongsToCustomer”.
Done! After successfully importing the Management Pack, I create a new folder (called “Customer Information”) using the Service Manager Console and save it to the same Management Pack. This folder will be used for different views. The first view I create is the “All Customers” view wich will be used to create and view customer objects.
Now I’m gonna create some customer objects that are displayed in the new view.
The next view I create will show all Windows Computers that are not yet assigned to a customer. I select “Combination Classes” and choose the Type Projection that is stored in my Management Pack (called CustomForm_xxxxxx). Then i define the criteria so that only Windows Computers are displayed that to not have a value in the “WindowsComputerBelongsToCustomer” display name field.
This Type Projection was automatically generated by the Authoring Tool when I customized the computer form. The name of the Type Projection is not very good readable and makes not a lot of sense, so it would be good if it would be renamed directly in XML.
After successfully creating the view, I create a second view that shows all Windows Computers that are already assigned to a customer. The only thing that is different from the first view is the criteria.
Now I start assigning Windows Computers to customers (using the new tab) and check if they appear/disappear from the two views.
For the finish I want to do some cosmetics because both column names in the two views are “Display Name” which can be confusing. This can be changed directly in XML, so I export the Management Pack and search the view.
Both columns are referenced with an ID. If you check the ID in the LanguagePack part of the MP, you can rename the second “displayname” to “customer”.
After re-importing the Management Pack the view looks better.
With that I end this blog post, but I already have plans about other posts about making Service Manager customer-aware. This really seems to be a requirement for many companies and I will therefore invest more time in this.