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

Prasad Dhumal
Mega Sage
Mega Sage

Have you tried making Child field Dependent on Parent?

Prasad Pagar
Mega Sage

Hi @DB 

I don't think its good idea as both fields are very important to create relationship(Manual/DataLoad/Discovery) and there must be a reason ServiceNow OOB dont have any dependency or reference qualifier on them.

I am not saying its not possible. You can customize it but I think its better not to.

Thank you
Prasad

Hi,

I am agree with @Prasad Pagar , as this is core table used to maintain relationships between CI's. Whole CMDB is working based on these two fields. If you add such configurations to these to these fields then it could lead to an issue with CMDB data. 

I would not recommend any changes to the dictionary for these fields. As all CI relationship's would be impacted with this change. 

 

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

Shubham Tipnis
Kilo Sage
Kilo Sage

Hi DB,

 

Its not recommended to change dictionary level configurations of something core like cmdb_rel_ci. But if you anyways want to achieve this then you could may be create a duplicate table which extends this table OR create dummy(duplicate) Parent and Child field's. Then you can make the child field dependent on parent. I am still not sure if this should be done but you can give it a try.

 

Please mark helpful/correct if applicable.

 

Regards,

Shubham

Regards,
Shubham Tipnis
 ServiceNow Enthusiast
️ 3x Rising Star (2022–2024) – ServiceNow Community
 Sharing insights, use cases & real-world learnings from the Now Platform
 Always learning. Always building.