Apply Principal Class filter in reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-16-2021 01:21 PM
Hi all,
we want to use Principal Class flag to filter CIs.
In the list view I can go to "Hamburger menu > Filter > Principal Class" what will add the javascript into filter conditions and I can get the correct results (see picture below)
However, if I want to build a report, I'm not able to anyhow apply Principal Class filter. I know I can select the classes in filter manually, but we might have up to 40 principal classes and changing all reports if we e.g. add new class would be a lot of work.
Does anyone an idea how to use Principal Class filter in reports?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-16-2021 02:27 PM
Hi Peter
You may consider opening CMDB_CI table in the list view and applying Filter > Principal Class to show only records from classes that are marked as principal. Next - go to Name column context menu of this list view and click Bar Chart there; it will generate a report template with the same applied javascript filter; you will be able to customize the report there if required.
Hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-16-2021 02:55 PM
Thank you Appli, interesting idea, however this is working fine only for newly created reports. If I want to update existing reportsI can't do it in a same way. Maybe only if I change the "sys_report.filter" field via script and insert the javascript, but it's only admin workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-07-2025 04:22 PM
Wouldn't it be nice if you could use the filter editor to add: Class is (dynamic) Principal Class?
Sorry to disappoint.
But if you think it's a good idea, vote for it!
Dynamic Filter Option for CMDB Class is (dynamic) Principal Class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-14-2025 12:58 PM
You can use this simple process to inject the Principal Class script into Report Builder:
- Open the CI list view and apply the Principal Classes filter.
- Right-click the column header of a field with a narrow value range (e.g., Operational Status).
- Select Bar Chart. The Report Builder will open, automatically pulling in the Principal Class script into the filter.
At this point, you can modify the report however you like; change the report type, adjust the parameters, and add other conditions.
This works for just about anything you can do in list view that does not have a Report Builder interface.
Important Limitation:
If you remove or modify the "Class (empty operator) javascript:new PrincipalClass().getPrincipalClasses()" condition, youâll need to repeat the process from scratch to restore it.
