- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 07:03 AM
Hi everyone,
I am new to ServiceNow development and I am struggling with this.
I am trying to modify the change form so that:
- the [category] field lists all active CI classes. the values of this field should come from the CMDB
- the [CI] field should be dependent on the [category] field
My question is:
- Which table stores the CI classes? If, there is none how do I query the list of active CI classes in my CMDB?
- Can you help with the script to accomplish this?
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 10:17 AM
HI,
Yes, determining "if it has records" could lead to false positives in a hierarchical table structure. If your choices are limited (say 15 or less) than manually creating the choice list is your best answer. Using the class name (e.g. cmdb_ci_server) as a value is encouraged in this case.
To get the CI field to filter on that class, just add a reference qualifier to the dictionary entry for that field.
For example:
javascript:'sys_class_name=' + current.category;
http://wiki.servicenow.com/index.php?title=Reference_Qualifiers
CAUTION: Look at using a dictionary override for your specific table (e.g. change_request) instead of changing the one on the form that is associated to task (and hence all other task related tables like incident, problem, sc_request, etc.)
http://wiki.servicenow.com/index.php?title=Dictionary_Overrides

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 07:36 AM
I'm happy to help. Thank you for the kind words. I hope we have a chance to meet in person some day soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 07:04 AM
I have a follow up question:
What if I want to filter the result to have just 'active' records?
The reference qualifier takes all CIs that have a sys_class_name=current.category; including those marked as inactive. I would like to exclude those.
How do I proceed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 07:07 AM
Hi,
Yes, you can 'add on' to the reference qualifier. The "and" part of that would look like this:
javascript:'sys_class_name=' + current.category + '^active=true'
Of course, 'active=true' is dependent on your field names. For example you may be using installed_status=in_production for example. Adjust accordingly.
The end result of advanced reference qualifiers is they have to be a valid encoded query string.
http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 08:26 AM
Hi ctomasi
I unfortunately noticed that using the CI table as value to the category list options is not accepted by ServiceNow system.
Those list options are not accepted and stored. Everytime I make the change and disconnect, to come back, those choice lists with values equal table names are removed from the category field.
Is there another way to achieve this?