Adding CI class reference field to different form

Dotychczas
Mega Guru

Hello experts,

I have an requirement to add CI class field to one form. Basically I want to create functionality so when user chose for example "Window Server" in that field, in another one which is the reference to cmdb_ci table only CIs in that class would be available. I can't manage to do it as type of class field on CI is sys_class_name. How should I approach that? 

Thanks

1 ACCEPTED SOLUTION

Alright 🙂

 

Normally this is pretty straight forward with a Reference Qualifier, but since you are dealing with CI's is a little different. I think it would something like this for a field with a reference to the cmdb_ci table:

 

javascript:"super_class=" + current.<1. field name>

 

Take a look at the documentation here:

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/script/server-scripting/con...

Especially the Advanced Reference Qualifiers Example section is interesting.

Hope it makes sense 🙂

 

-Mark

 

View solution in original post

9 REPLIES 9

Alright, so the 1. field should also be a reference field also with a Reference Qualifier on it. If the CI's you want in this list, share a common parent CI you would do something like

javascript:"super_class=" + "<sys_id of parent CI>"

Otherwise if you have a list of sys_id's, you chould do something like:

javascript:"sys_idIN" + "<sys_id>,<sys_id>,<sys_id>"

 

I need list of every class that can be set on CI so user can chose one class and on it's basis chose CIs that have same class as chosen one. 

How to create reference field with list of all possible classes?

Did this solve the issue?

Yeah, sure. I mean I was asking about something different but reference qualifier was good answer. I think that I made it simpler but yeah It's working now.

Kind Regards

Awesome! Glad you got it working!