Remove CI Relationships
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2014 05:48 PM
My goal is to be able to "retire or decommission" a CI. Using the Server Class, I will use a Windows Server as an example.
In our environment, we can retire a server running Windows, then bring it back online as a Linux machine. For reporting purposes and requirements by our CMDB team, we will need to keep the old CI record and the new CI discovered record. The current server will be active with all details and the previous server is set to inactive and numerous fields are cleared.
I have the code for removing all fields and linking the old CI to the new CI, but I am looking for assistance with the removing relationships part. What is the best way to purge the relationships on a CI?
Example: The retired Windows server was running an instance of MSSQL. This machine is clearly no longer running the database. So while we want to keep the records about the software that was installed, disk drives, serial numbers etc... , I want to remove the relationship(s) that would only be accurate if the machine is still "active". What is the best way to handle this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2014 03:31 PM
Looks like you didn't mark it as a question when you posted it. No worries, I'm glad you've got a solution that works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2015 07:42 AM
Hi Mark
This is a great solution and is very much appreciated, but there appears to be a negative side effect. Removing the relationships from the retired CI, causes them to also be removed for all historical records. If I've recorded a change request against a CI and later retire that CI, I end up losing the entire BSM. When my auditors review our change management process and try to look at what was impacted by making changes to a specific CI (now retired), that information is no longer available.
Would we require another table to store the historical relationship information within and then reference that table for closed changes or is there a better solution you can suggest.
As always, thanks very much for all you contribute to the community.
Cheers
Ron

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2015 07:50 AM
Hey Ron. The problem here is that ServiceNow doesn't track multiple versions of the BSM relationships...so there is no such thing as a 'Historical record' here. In order to do what you're looking for, you do need a separate table to contain the information. I think the closest thing to this OOB is the 'Impacted Services' related list that you can make available on the change request form.
When Crossfuze sets this up, we calculate all impacted business services for every change on approval request, and every incident on closure. This gives customers a listing of this data at that point in time, regardless of future changes made to the living BSM map.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2015 08:07 AM
Great solution Mark!
Thanks again for your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2015 08:51 PM
Hi Mark,
I have a similar requirement to "Retire application remove all associated CI". I used you script in after business rule on cmdb_ci_appl and its working grate.
I am new to service now and wanted to check if I am doing it correct.
Also, you script only removes the relationship correct? it will not delete the ci's correct?
Thanks
S