Catalog item variable to select CI related to another CI

Vincent Messier
Tera Expert

I am trying to build a catalog item that will select an IBM Websphere record on a server. I would like to select the server on a variable and then only show the websphere records with a runs on relations with that server on another variable.

 

I need to do that for oracle database and other type of related CI but wonder how to achieve this kind of selections. I have tried with a database view that had both fields but had no luck.

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

Hi Vincent,

The variable that displays the related records should be the type of reference, on whichever CI table holds these.  The key is the reference qualifier, which in this case will look similar to this:

BradBowman_2-1696265928250.png

 

Where CI_Helper is the name of a client callable Script Include, getFilteredCIs is the name of a function in that SI, and v_server is the name of your server variable.

The Script Include will query the cmdb_rel_ci table to fit whatever relationships you're looking for - so the v_server variable passed in as an argument to the function is the parent (or child instead?), and the type is whatever you're using.  Push each child or parent sys_id to an array within the where loop in the GR, then return 'sys_idIN' + ciArr.join(','); where ciArr is the name of the array you pushed the results to. 

 

Give this a try and post the script if you run into trouble.

 

 

 

Am I suppose to have CI_Helper already available OOB or you are telling me I need to write a script include myself to achieve my requirements.

Sorry, that's just an example of a Script Include name and function.  You'll need to create a new SI, or at least a new function in one of your SIs for this.