remove servers from business service

ShubhiGarhwal
Tera Contributor

ShubhiGarhwal_0-1715103240059.png

Hi all,

how do I remove this server from business service.I have marked this server to non operational and install status to retire this is still showing in business service.

4 REPLIES 4

Deepak Shaerma
Kilo Sage

Hi @ShubhiGarhwal 

 

Write a before update business rule on your server table. 

Change the field and table names according to your exact table.

 

if (current.operational_status == 'non_operational' && current.install_status == 'retire') {
            
            // Query for related business services
            var rel = new GlideRecord('cmdb_rel_ci');
            rel.addQuery('child', current.sys_id); // or ‘parent’ based on your setup
            rel.query();
            
            while(rel.next()) {
                // ‘type’ is the field that links to a Business Service; adjust field names as necessary
                if (rel.type.getDisplayValue() == 'Uses::Used by') {
                    rel.deleteRecord(); // Remove the relationship
                }
            }

        }

AndersBGS
Tera Patron
Tera Patron

Hi @ShubhiGarhwal ,

 

You need to go to the relationship builder and remove the relationship. 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

There is no relationship with this server

 

 

Hi @ShubhiGarhwal ,

 

If there is no relation between the business service and the server, why is the server then shown on the related list of the business service? Have you looked into the cmdb_rel_ci table? 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/