Blank Values in a Service Manager CSV Import

Author by Christopher Mank

One of the really cool features I love about Service Manager is the CSV Import function.  With the ability to create/update objects and type projections right from a CSV file, you truly have the ability to integrate SM with just about any tool out there.  If the application can export its data to CSV format, then it can be imported easily.  Another added bonus is you can design the SM data structure how you like it.  For example, just because your 3rd party application stores a PC's Lease Schedule Number on the same class as the asset doesn't mean you have to.  You can create your own Lease class and using the 3rd party app's data, import it into your data structure that better meets your organization's needs. The main reason I find myself using the CSV Import is for doing bulk record creations or updates.  Although you can script these actions using PowerShell, Orchestrator SM Activities or the SDK, I find that the CSV Import performs much  faster than the others.  For that reason, I like to use it when building out custom connectors. Just recently when building out some custom connectors, I noticed that some of the data that was in the CSV import file was not updating in SM.  After some further investigation, this is what I found.  Blank values in a CSV import will NOT blank out the field, the field will be skipped.  Let's look at this a bit more closely. Let's look at an example of updating a Windows Computer object.  Below we have a simple XML Format file and CSV Import file that will update the NetbiosComputerName field of an existing object to "MyNetbiosName". Windows Computer CSV Format File Image CSV Import with non-blank value Image After we run the import, we can see our object updated correctly with our new NetbiosComputerName field. SM Windows Computer Form Image Now, if we blank out our field as shown below, we see that once the import is complete, the field still shows the same value it did before. CSV Import with blank value Image SM Windows Computer Form Image Conclusion: Blank values in a CSV import will NOT blank out the field, the field will be skipped.  This behavior, in most scenarios, is perfectly fine.  Where this really comes into play is when configuring custom connectors to read data from a data source and update it into SM.  Take updating a custom property in Active Directory for example.  Let's say you have configured a 2nd Fax Line in AD and it is syncing to SM.  Let's also say that Terrance has 2 fax lines, synced to SM.  Then about 3 months later, Terrance gets rid of his 2nd Fax line and the number is removed from AD.  If you are using the CSV Import to facilitate these updates, Terrance's 2nd Fax line will NOT get blanked out by putting a blank value in the CSV import, it will just get skipped.  So depending on what you plan to use the CSV Import function for, be aware that blank CSV values do NOT blank out the indicated fields. So how do you work around this?  Good news is, there is a way, and it all depends on how you build your custom connectors.  Perhaps in the future I'll show you how we've built our custom connectors that not only takes this into account, but also includes a stock pile of other cool features, like delta only imports and custom connector logging.  Stay Tuned... Until the Whole World Hears, Christopher    


Christopher Mank

Systems Architect