Add unique ID (CI ID) for all CMDB classes

nancyhz
Mega Contributor

I have created CI ID field as a unique filed in cmdb_ci TABLE to be used to
all CI as unique identifier.   It works well when new CI record is created
, which a unique CI id: CIxxxxxxxxx will be generated. However,   We
have many CIs were already imported into ServiceNow CMDB.   My
question is how can we add a unique CI ID to the existing   CI records, or
CI data that we will import to ServiceNow future.

 

 

I really need your expertise to point me to right direction.   I greatly
appreciate your feedback

4 REPLIES 4

prdelong
Kilo Guru

You can use a scheduled job or background script to populate all the current CIs using the default method SN uses to increment their ticket numbers (getNextObjNumberPadded()). If you loop through all existing (or desired) CIs to assign the GUID/CIID, you will have that taken care of.



I would make sure to do the follow in the script:



1) query for all hardware and application type CIs (more if you're importing software, disk, and NIC info)


2) sort by descending, so the largest CI ID will be the first result


3) use the getNextObjNumberPadded(); function to grab the next result (or increment it yourself)


4) update the record


Jim Coyne
Kilo Patron

The following post may help you out - Error while numbering CIs


Many thanks for your information.   It works as we expected


ekoyen
Kilo Explorer

To get additional info/hints please see next wiki links:


http://wiki.servicenow.com/index.php?title=System_Dictionary


http://wiki.servicenow.com/index.php?title=CSHelp:Dictionary_Entry


http://wiki.servicenow.com/index.php?title=Reference_Qualifiers



Note: recommended to update existing CIs in the CMDB or create a new CI if no match is found - based on:


1. Serial Number in the cmdb_ci_computer table


2. MAC Address in the cmdb_ci_network_adapter table


3. Computer Name in the cmdb_ci_computer table