Create a missing asset record for an existing CI

Phil32
Tera Expert

We have a physical server that was created manually back in 2014.   It did not get an Asset record created for some reason.

The CMDB CI has 245 updates and has been linked to multiple CHG and INC tickets, so we can't delete it.

How do we get an Asset record created for this system?

6 REPLIES 6

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could create a new one and then run a background script that changes all the references or you could create an asset and the mappings with a background script.


I'm not a ServiceNow admin but the CMDB manager.   Is that an Admin only function?


Yes background scripts can only be run as an administrator.


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

This has happened to me before when I didn't setup my model categories correctly.   There is an out of the box business rule called "Create Asset on insert" that runs when a CI is inserted that will then generate an asset record.   My recommendation is to call that same script via background script and it should create an Asset for you.



So get the SysID of the CI, and put it into the following script:


var ciSysID = "SYS-ID-OF-CI";


var ciRec = new GlideRecord("cmdb_ci");


ciRec.get(ciSysID);


var ca = new AssetandCI();


ca.createAsset(ciRec);



Then elevate your roles to security_admin and then navigate to System Definition\Scripts - Background and paste in the modified script.   This should create an asset for you.   I would recommend trying this in a dev or test instance first.