SCSM: Using multiple key properties in classes

When configuring new classes in Service Manager, you always need to specify a key property. This property must have a unique value for all instantiated objects of that specific class. Often a key property is created by using an id value that increments automatically. This makes sense in many situations, however when constantly importing objects from other management systems it can make more sense to change tactics and use other properties as key properties – if needed also more than one

I created some post in the past that talk about using id-bases key properties. Check out this post to get an understanding how auto incrementing key properties can be used:

https://marcelzehner.ch/2011/06/04/autoincrement-property-ids/

Sometimes it can make more sense to use non-incrementing properties as key properties. This can be easily configured in the Authoring Tool or directly in XML. If needed you can also define multiple key properties. Think about this scenario:

  • You want to create your very own application class
  • You want to synchronize applications with your own method (SCORCH runbook) to the CMDB
  • You don’t want to build any logic into the synchronization process

This could be one way to go. Create a new class and define the needed properties. In this example I added only 3 properties (name, vendor and version) and I marked name and version both as a key property. None of them are auto incrementing properties). Than means that objects with exactly the same name and version can only exist once in the CMDB.

image

After the MP is sealed and imported, you can start synchronizing objects to the CMDB. This could be done using a SCORCH runbook. In this example I will use simple CSV import procedures to demonstrate the scenario. I will not go into any detail here because this has been discussed earlier:

https://marcelzehner.ch/2011/01/02/csv-import-of-objects/

https://marcelzehner.ch/2011/05/20/csv-import-of-objects-using-type-projections/

So this is my xml format file:

image

This is my sample data file:

image

After the import is complete, the objects can be displayed using a simple view.

image

image

As you can see, the instances has been created using the values from the data file. The display name property has been automatically populated with values from the two key properties. The key properties are automatically marked as read only on the generic form.

Now what happens when our “connector” runs again? I changed the data file a little bit: I added a new row and changed the version value of 2 existing rows.

image

Now I import again. Guess what happens? The new row will create a new object. Because I changed the key property value on 2 rows this will also add new objects. So 3 new objects in total. That makes sense.

image

Now, what happens if I change a value that is not a key property and import the CSV again? You know it: it will not create new objects but update the existing ones.

image

image

This example showed how to import data using CSV files. In a real world it would be more comfortable to use a SCORCH runbook. The runbook could connect to SCCM and read out all Applications, then write it to the CMDB. With a clever key property configuration the runbook needs no logic that makes sure every application is only written once to the CMDB because the data model takes care of that and data consistency will be better with that approach. This is of course only a simple example, but it demonstrates how valuable and important key properties are or can be.

Cheers
Marcel

This entry was posted in SCSM and tagged , , , , , , . Bookmark the permalink.

One Response to SCSM: Using multiple key properties in classes

  1. very interesting! , Waiting for new articles 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s