Restrict Dropdown for field of type Table Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2025 02:17 AM
I have this dropdown of tables, it is a dictionary field of type table name.
Now I want to restrict this to only have non sys tables but also include database views, is there any way to do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hello Abhinavmoha,
Did you find the solution for this ?
Warm Regards,
Rakesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @abhinavmoha ,
As per my understanding, below will be the option solutions which might help you.
Option 1 – Reference Qualifier (Recommended)
1. Go to the dictionary entry of your field.
2. In the Reference Qual field, add:
javascript: 'nameNOT LIKE sys_' + '^' + '(super_classISNOTEMPTY^ORis_view=true)'
3. 
Explanation:
* nameNOT LIKE sys_ → Excludes tables starting with sys_
* (super_classISNOTEMPTY) → Includes actual extended tables
* is_view=true → Includes database views
Note: sys_db_object has the following useful fields:
* name – table name
* super_class – extended parent table reference
* is_view – boolean if it’s a DB view
Option 2 – Client Script Filtering
If the field is a dropdown rendered in UI and you can’t directly put a ref qual, you can filter options on form load
function onLoad() {
var tableField = g_form.getField('your_table_field');
var options = g_form.getOption('your_table_field');
for (var i = options.length - 1; i >= 0; i--) {
var optValue = options[i].value;
if (optValue.startsWith('sys_') && optValue !== '') {
g_form.removeOption('your_table_field', optValue);
}
}
}
Then, separately, you’d still need to ensure DB views are allowed (they are usually already included unless excluded by another script).
Option 3 – Use a Custom Table Picker
If you want absolute control:
* Create your own reference field pointing to sys_db_object.
* Apply the exact filter:
nameNOT LIKE sys_^is_extendable=true^ORis_view=true
* Populate your dropdown from this filtered list.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025