Skip to main content

Service Manager CSV Import - Beware of the Default Value

Author by Christopher Mank

One of the greatest features of Service Manager is the ability to do CSV imports of data right into the CMDB. This gives you the ability to create a custom connector into any application that can export its data into a CSV format. The instructions found in the following link give a great explanation of how to use this feature.  With that said, there is one caveat that you should be aware of as you build out your custom connectors. When you build custom classes in the Service Manager Authoring Tool, one of the options you have is to set a Default Value.  This is helpful when you want to auto-populate data properties when new instances of the class are created.  The one thing to keep in mind, however, is when you do a CSV import of a class that has Default Values, if you do not specify the value in the CSV file, the import will change its current value to the Default Value.  To demonstrate what happens, let's take a look at the following example. I created a new Management Pack (MP) and called it TestMP.  I then created a new class called Catalog.  In the class, there is boolean property called IsActive.  I set a Default Value of 'False'. I imported this MP into Service Manager and created a new instance of Catalog.  As you can see below, the IsActive field was automatically set to 'False'. After saving the form, I went back in and changed the IsActive field to 'True' and saved the form. Next, I created an XML format and CSV file that will update the Description field and imported it into Service Manager.  As you notice, the IsActive property is not specified at all in this import. Format File: CSV File: After the import completed, I opened the Catalog object to see the results of the import.  As you can see below, the Description field updated correctly.  However, if you notice the IsActive field, the value changed back to 'False'. If you do any CSV imports of a class that contains Default Values, and you do not specify the value of that property, the system will automatically change that property to its Default Value.  This may be undesired behavior, especially if you are updating existing records.  One workaround you can do, if you want to automate your CSV import, is use PowerShell to find the current value of the property with the Default Value and add it to the CSV file so it doesn't overwrite during the import.  This is definitely something you want to keep in mind when configuring custom classes and importing CSV files. Until the Whole World Hears... Christopher

Christopher Mank

Systems Architect