Related CI Hierarchy

Paul Coste2
Giga Expert

In the Configuration Item form, one of the sections is the Relationships formatter, where the upstream and downstream CIs are displayed based on the selected depth level and flat or hierarchical view.   This means that whenever this is displayed, this area is updated, and ServiceNow will walk all possible paths to the specified level.   This is similar logic to what is running in the CIUtils script when calculating Impacted Services, but it can't be the same code that is running, as the CIUtilis code is specific to Services.

Questions about this formatter:

  1. Where is the code and when is it run?
  2. Can I leverage or modify this code?   Has anyone tried to do so?

The reason for the question is that I am interested in doing some work that will walk the relationship path from a given CI, and I would like to leverage existing code if possible.

5 REPLIES 5

Gurpreet07
Mega Sage

There are two scripts doing this


gwt_tree2.jsx            


CITree2Node.jsx



Save complete webpage using firefox and you will get complete code in these two scripts.


We customized CITree2Node.jsx to create tree view of Business services.First we modified the code, renamed script and uploaded to UI Scripts then used them in a UI Page using following code.



<script>


<script>                                                                                   <!--Customized CITree2Node.jsx -->


<div id="ci_relation_tree">


</div>


<script>        


  var t = new GwtTree2("ci_relation_tree", "ci_relation_tree");


                              t.processor = "com.snc.cmdb.ECMDBAjaxProcessor";


  t.showRootNode = true;


  var f1 = new CITree2Node(t, "b7b90221847f1940c095cfebdde3b5c1");                         //sys_id of root node


  f1.setText("Service Portfolio");


      f1.sys_id = "b7b90221847f1940c095cfebdde3b5c1";


  f1.setTable("cmdb_ci_service");


  f1.setChildName("child");


  f1.setParentName("parent");


  f1.setCanExpand(true);


  f1.setNodeOpenImage("images/icons/business_services.gifx");


  f1.setNodeClosedImage("images/icons/business_services.gifx");


  f1.show();


                              f1.expand();


  </script>


Thanks Gurpreet.   At least it is good to know others are out there looking at CI relationships.   Unfortunately, saving the complete webpage in Firefox with or without the Relationships tab displayed on a CI form I could not confirm what you found.   There were no references to these specific jsx scripts included.   Perhaps there is a version difference.


Hi Paul,



I have been added and attachment of following CI of its compete web page to the same record. Its having both of these files in the folder.


ServiceNow


Still not following.   This is a link to the enterprise demo page.   Thanks for trying.