Delete Asset Record without deleting the CI

tschenke
Giga Contributor

I have been testing some of the asset creation rules with our Windows Server model category.   We were not creating assets for servers and I needed to start but need to exclude any VMs.   I added a condition for the Create Assets on Insert business rule to exclude if virtual was true but forgot a space, the rule failed, and all of the VMs were created as assets.   I'd like to remove those assets from Hardware Assets but it appears when I delete an asset record, it also deletes the CI.   How can I delete just the asset record and leave the CI?  

1 ACCEPTED SOLUTION

tltoulson
Kilo Sage

Hi Tony,



I actually had to do exactly this last week.   On the cmdb_ci table, Personalize the Dictionary.   Open the Asset field.   Clear out the Reference cascade rule field.   This will set the default rule which is to clear the reference when deleting the related record.   Currently it is set to delete which causes the CI to be deleted whenever its related Asset is deleted.   You can set it back when you are done if needed.


View solution in original post

4 REPLIES 4

tltoulson
Kilo Sage

Hi Tony,



I actually had to do exactly this last week.   On the cmdb_ci table, Personalize the Dictionary.   Open the Asset field.   Clear out the Reference cascade rule field.   This will set the default rule which is to clear the reference when deleting the related record.   Currently it is set to delete which causes the CI to be deleted whenever its related Asset is deleted.   You can set it back when you are done if needed.


That did it.   Thanks for your help!


Henrik Jutterst
Tera Guru

I just wanted to update this post with a more recent answer on how to delete an Asset without deleting the related CI.



You should delete an asset only to clean up errors. For tracking purposes, the correct method for managing an asset that is no longer in use is to change the state of the asset to Retired.


Procedure


  1. Navigate to Asset > Portfolios > All Assets.
  2. Select the check box to the left of the asset Name.
  3. In the Actions choice list below the list, select Delete Asset Only.



find_real_file.png



More info here: Asset and CI management


Ankit Padia
Tera Contributor

You can use the below code if you are using bulk delete via script

 

var a = new AssetandCI();
a.deleteAssetOnly(current);