Creating a Dynamic filter option for System Class Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 12:38 PM - edited 05-17-2024 12:39 PM
When displaying Configuration Items in a list (or other conditions) I would like to have a dynamic filter that says "is (dynamic) Principal Class".
In theory this should be simple, since the "=" condition will already work in an encoded query using this syntax:
sys_class_name=javascript:new PrincipalClass().getPrincipalClasses();
However, following the instructions on Create a dynamic filter option, I cannot get this to happen. I have tried using System Class Name as the field type and Table Name as the field type, but nothing seems to work. Then I looked closer at the instructions and it says to set Field Type to Reference. Problem is, System Class Name is not a Reference field type. I see that there is the option to create dynamic filter options for non-Reference field types, and there are some of these created out of the box, but most of these do not seem to be selected to display in a Filter.
Is there a way to do this? It would be extremely valuable to be able to easily filter Principal Classes in a CI list.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 02:17 AM
I'd agree it would be good to have that level of filtering available. SNs workaround doesn't work within the UI, but you can force it by editing the URL and doing sys_class_nameINjavascript:new PrincipalClass().getPrincipalClasses();
Not the friendliest of options....
Digging through the code that constructs the operators available for each field type, the sys_class_name is restricted to only being allowed the following:
equal to 'is'
not equal to 'is not'
instance of 'is a'
any 'is anything'
fvc 'changes'
fvf 'changes from'
fvt 'changes to'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 09:35 AM
Yes, certainly even without the Dynamic option, it would be good to have easier access to the ability to call the javascript from the normal Filter, which as you point out can only be done by manipulating the URL directly. But as you also rightly point out, the "=/is" operator is what is supported for the System Class Name field, and thus, it would seem on the surface that the Dynamic Filter Option should simply use that same logic. But it doesn't.
Focusing just on the Dynamic Filter Option question, therefore, it seems to me that the documentation and/or the implementation logic for this capability is just incomplete. There is nothing in either the UI or the documentation that indicates such a Dynamic Filter Option won't work. ServiceNow really needs to flesh out and document exactly how this works, and ideally provide more capabilities for different non-Reference field types if that is a confirmed limitation.
I figured it was a long shot that someone might know more about how Dynamic Filter Option actually works than what is documented in ServiceNow, but worth a discussion in any case. Thanks for responding!
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 03:40 PM
I found this after trying myself and hitting the wall. Has anyone opened an FTASK for, "Allow dynamic filter options on the System Class Name field type?" It's Friday. I'm not motivated enough to create my own only to have it ignored...