show records - based on Parent class

DB1
Tera Contributor

Hi all,

I have a requirement and would request help on the same. on cmdb_rel_ci table :

1. Parent class (field) and Child class (field)

2. When parent. class name = 'software' I want on the child field to show or display records 2 child class related records to be shown on the reference icon

'Application' and 'server'

 

How can the below be achieved

find_real_file.png

1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

Hi,

You can make following changes to the dictionary of Child field on cmdb_ci_rel table to achieve your use case:

find_real_file.png

Here is the advanced reference qualifier condition:

javascript: (current.parent.sys_class_name=='cmdb_ci_spkg')? 'sys_class_nameINcmdb_ci_appl,cmdb_ci_server':''

 

Used sys_class names for the CI classes you mentioned.

Software<cmdb_ci_spkg>

Application<cmdb_ci_appl>

Server <cmdb_ci_server>

 

Also this change will limit classes only when parent is 'software <cmdb_ci_spkg>', for other classes it will show all records.

 

Please mark helpful and correct if this resolve your issue.

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

10 REPLIES 10

John Zhang1
Kilo Patron
Kilo Patron

The CI relation table (cmdb_rel_ci.) can't help you the form field level dependency.  We did similar user case on other app.

You can use AJAX within OnChange client script for the "Parent" field to call new script include and get a list of sysID for child table.

1) Create Client call Script Include, which will return a list of sysID for child table

2) AJAX call like following sample - get a list of child sysIDs and assigned to child field.

find_real_file.png

 

 

DB1
Tera Contributor

Thanks for the reply

DB1
Tera Contributor

Can anyone help with the logic please?

DB1
Tera Contributor

Not sure how dependent would help because it is on cmdb rel table so when a single parent class is selected it should show 2 child classes only when reference look up icon is selected. 

Anil Lande
Kilo Patron

Hi,

You can make following changes to the dictionary of Child field on cmdb_ci_rel table to achieve your use case:

find_real_file.png

Here is the advanced reference qualifier condition:

javascript: (current.parent.sys_class_name=='cmdb_ci_spkg')? 'sys_class_nameINcmdb_ci_appl,cmdb_ci_server':''

 

Used sys_class names for the CI classes you mentioned.

Software<cmdb_ci_spkg>

Application<cmdb_ci_appl>

Server <cmdb_ci_server>

 

Also this change will limit classes only when parent is 'software <cmdb_ci_spkg>', for other classes it will show all records.

 

Please mark helpful and correct if this resolve your issue.

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande