Get Related Services for a CI (Dynamic CI Group)

Edward Halliday
Mega Guru

Hi All,

Below is a CI which is within a Dynamic CI Group (All EUC Computers). In the dependency view i have a related services tab which shows this relationship. 

But if i was writing a script...How could i find the Dynamic CI Group's that this CI is in? 

 

find_real_file.png

1 ACCEPTED SOLUTION

Martin Grosskop
Tera Guru

HI Edward,

 

The relationships are held in the svc_ci_assoc table.

But note that the relationships are not just for CI and Dynamic CI Groups. It is for CI and all extensions of the cmdb_ci_service_auto class, which includes cmdb_ci_query_based_service a.k.a. Dynamic CI Group.

So if you wanted to get only Dynamic CI groups you would need to modify your query to look for only cmdb_ci_query _based_service records.

Eg:

    var gr = new GlideRecord('svc_ci_assoc');
    gr.addEncodedQuery('service_id.sys_class_name=cmdb_ci_query_based_service');
    gr.query();

Regards,

Martin

View solution in original post

1 REPLY 1

Martin Grosskop
Tera Guru

HI Edward,

 

The relationships are held in the svc_ci_assoc table.

But note that the relationships are not just for CI and Dynamic CI Groups. It is for CI and all extensions of the cmdb_ci_service_auto class, which includes cmdb_ci_query_based_service a.k.a. Dynamic CI Group.

So if you wanted to get only Dynamic CI groups you would need to modify your query to look for only cmdb_ci_query _based_service records.

Eg:

    var gr = new GlideRecord('svc_ci_assoc');
    gr.addEncodedQuery('service_id.sys_class_name=cmdb_ci_query_based_service');
    gr.query();

Regards,

Martin