Set CI Default view to be the same for All Classes
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
the subclasses are not inheriting the CI default view of the parent class, and I would like them to have the same view.
Every CI class is having its own view.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Child CI classes inherit the parents view only until someone customizes the form on that child table. Platform creates view records keyed to that child class, which then shadow the parents view.
Delete those child-specific records and inheritance is restored:
1. sys_ui_form.list → Name = <child class> AND View = Default → delete
2. sys_ui_section.list → Name = <child class> AND View = Default → delete
To bulk-reset all descendants of cmdb_ci you can try the below script
var ROOT = cmdb_ci;
// Get Default view sys_ids (name is sometimes blank)
var views = [];
var v = new GlideRecord(sys_ui_view);
v.addQuery(name, Default).addOrCondition(name, );
v.query();
while (v.next()) views.push(v.getUniqueValue());
// Collect all descendants recursively
var tables = [];
(function collect(parent) {
var t = new GlideRecord(sys_db_object);
t.addQuery(super_class.name, parent);
t.query();
while (t.next()) { tables.push(t.name + ); collect(t.name + ); }
})(ROOT);
// Delete child-specific Default view records
[sys_ui_form, sys_ui_section].forEach(function(tbl) {
var gr = new GlideRecord(tbl);
gr.addQuery(name, IN, tables.join(,));
gr.addQuery(view, IN, views.join(,));
gr.query();
while (gr.next()) gr.deleteRecord();
});
