
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2018 06:47 AM
So I have been looking for a way to filter a field that has the type of "Table Name" to only show tables that are an instance of CMDB and I'm not finding a way to do it.
I tried "nameINSTANCEOFcmdb" but that did not work.
Anyone have any thoughts on this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2018 06:58 AM
The system does not show the fields on the form. I'm/was hoping that I could find a way to do it.
Right now I'm using a reference field to sys_db_object then I used the Ref Qual of "nameINSTANCEOFcmdb". Just not a fan of how it came out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2018 07:12 AM
Are you trying to filter it so when someone inserts a new CI there tables are limited to valid choices?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2018 03:18 AM
Something like that but not for creating CI's. I need the user to select a table that is a child of cmdb_ci so that they can create a filter for the table they selected. I was hoping to use a Table Name field but it appears that there is no easy way to get it to filter to a sub set of tables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:22 AM
You can write a script include to do this, the tableChoicesScript dictionary attribute allows you to write a reference qualifier for the 'table_name' field type.
https://docs.servicenow.com/bundle/paris-platform-administration/page/administer/reference-pages/concept/c_DictionaryAttributes.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 06:53 PM - edited ‎09-04-2024 08:58 AM
Exactly what I needed. I didn't even know that feature existed. Thanks!
(EDIT: Version-neutral link to the doc referenced above: https://docs.servicenow.com/csh?topicname=c_DictionaryAttributes.html&version=latest)
And for anyone looking for this solution in the future - in a scoped app you can create a script include for this exact purpose that looks like this:
var CmdbTables = Class.create(); CmdbTables.prototype = { initialize: function() { }, process: function() { var table = new GlideTableHierarchy('cmdb_ci'); var cmdbTables = table.getAllExtensions(); return cmdbTables; }, type: 'CmdbTables' };
Then just add this attribute to your Table Name type field:
tableChoicesScript=CmdbTables
If you want to do this in Global, I believe you'll need to use the out-of-box TableUtils script include. Your process function should look something like this:
var table = new TableUtils("cmdb_ci"); var cmdbTables = table.getAllExtensions(); var cmdbTablesArr = j2js(cmdbTables); return cmdbTablesArr;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2022 12:47 AM
That's a great explanation 🙂