How to get the list of associated CIs to service map?

TomaszO
Giga Contributor

Dear All,

I`m facing a challenge to obtain a list of CIs visible on a Service map for a given Application service.

After a long discussion with support, I did not get an answer that would meet my requirements.

In essence, there is a table called:svc_ci_assoc which contains all CIs identified as part of the application service map but this table ALSO CONTAINS HISTORICAL CIs which are no longer visible on the service map.

There is the method: saListCis it also has historical items on the list.

Could you please advice if there is a way to get a list of all CIs that are currently available on a service map ?

Below our use cases where we need it.

1.Use case 1:

  • We built the Catalog Item
  • On catalog item, we have defined the variable called: Web server name
  • There are two variables: InstallBase/ApplicationService & Web server
  • A list of available values in the Web server list must contain a list of web servers filtered to the servers which are available on a service map.
  • The default value should be set as the first web server that exists on the service map

We want to filter the list only to CIs available under the service map for the given InstallBase/application service.

We want to select the value if only one is on such a list so that the automation script can use it in next steps

2.Use case 2

  • We want to build an audit for the service map refresh process
  • After the service maps refresh process is completed we need to make sure that all required Ci types are included on the map.
  • If some are missing such an Application service should be marked as "faulty service map"

We`d like to build an Audit that shows the application services which does not have on the service map windows server containing the name "WEBP".

4 REPLIES 4

Jordan Hladish1
Kilo Expert

When you click "List CIs" when looking at a Service Map - does this show the correct list of CIs for you?

This is the script ran on the back-end of that UI Action. You may be able to tweak the input from 

var manager = new SNC.SvcAssocPopulationManager();
manager.syncSingleService(current.sys_id, false);
action.setReturnURL(current);
action.setRedirectURL('cmdb_ci_list.do?sysparm_query=sys_idINjavascript:saListCis(\'' + current.sys_id + '\')');

This might give you a start for creating a custom solution for this. Possibly dynamically displaying the list by running the code in a "javascript:" in the filter?

Just an idea if nothing fits your needs yet.

This reply is very helpful. I will ask my engineers to test how does it fit to our case.

TomaszO
Giga Contributor

Dear All,

We got a chance to talk on a call to one of the SvC expert, former developer.

During a call he explian that the table called:svc_ci_assoc  and the method saListCiS should not return any historical items.

After analyze of our case it turns out that suspicious Ci that was returned was there as one of other CIs ( Windows server ) has two Virtual machices attached to it ( we do not know the reason yet ).

There are also some other elements that are suspicuios however for my business cases it looks like it will not be an issue as we only look for specific classess on the map like windows server, mssql database.

All in all it means that we should use the method or table.

BR,

Tomasz 

Rahul Priyadars
Giga Sage
Giga Sage

See if below Article helps you- How to Traverse the CI relationship Tree.

Walking the ServiceNow CMDB Relationship Tree

 

https://servicenowguru.com/scripting/script-includes-scripting/walking-servicenowcom-cmdb-relationsh...

Regards

RP