Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Set CI Default view to be the same for All Classes

Hamissa
Tera Contributor

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

Naveen20
ServiceNow Employee
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.listName = <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();
});