How to Sort Items in "ALL" and "Pinned" Tabs on Change Catalog Vie
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2025 01:48 PM
When creating a new Change request in our ServiceNow instance, we see four tabs in the catalog view: Pinned, Models, Preapproved, and All.
The Models and Preapproved tabs are already sorted in a meaningful order, but the Pinned and All tabs appear unsorted, making it harder for users to find relevant items quickly.
I'd like to know:
- Is there a way to customize the sorting of items in the All and Pinned tabs?
- Can this be done via configuration, or does it require scripting or customization?
- Are there any best practices or recommended approaches for sorting catalog items in these views?
Any guidance or examples would be greatly appreciated!
Thanks in advance!
I have added below script in "StandardChangeTemplate" But it is only working for pre approved tab. It is not working for ALL , Pinned tabs.
var StandardChangeTemplate = Class.create();
StandardChangeTemplate.findById = StandardChangeTemplateSNC.findById;
StandardChangeTemplate.findAll = StandardChangeTemplateSNC.findAll;
StandardChangeTemplate.prototype = Object.extendsObject(StandardChangeTemplateSNC, {
initialize: function(_gr, _gs) {
StandardChangeTemplateSNC.prototype.initialize.call(this, _gr, _gs);
},
type: "StandardChangeTemplate"
});
StandardChangeTemplate.findAll = function(orderBy, textSearch, encodedQuery) {
orderBy = orderBy || ChangeProcess.NAME;
var changeRecordProducerGr = new GlideRecordSecure(StandardChangeTemplateSNC.CHANGE_RECORD_PRODUCER);
changeRecordProducerGr.addActiveQuery();
changeRecordProducerGr.addQuery("retired", false);
if (textSearch !== undefined && textSearch !== "undefined" && textSearch.trim() !== "")
changeRecordProducerGr.addQuery("name", "CONTAINS", textSearch).addOrCondition("short_description", "CONTAINS", textSearch);
if (encodedQuery !== undefined && encodedQuery !== "undefined" && encodedQuery.trim() !== "")
changeRecordProducerGr.addEncodedQuery(encodedQuery);
changeRecordProducerGr.orderBy(orderBy);
changeRecordProducerGr.query();
//Get a list of readable templates which might have user criteria in place if enabled
if ((gs.getProperty("com.snc.change_request.standard_change.use_user_criteria", 'true') === 'true') && (gs.getProperty("glide.sc.use_user_criteria", 'true') === 'true')) {
var readableRecords = [];
while (changeRecordProducerGr.next()) {
var sysId = changeRecordProducerGr.getUniqueValue();
if (new sn_sc.CatItem(sysId).canView())
readableRecords.push(sysId);
}
changeRecordProducerGr = new GlideRecord(StandardChangeTemplateSNC.CHANGE_RECORD_PRODUCER);
changeRecordProducerGr.addQuery('sys_id', "IN", readableRecords.join());
// START OF MODIFIED CODE THAT ENSURES CARDS ARE SORTED IN ORDER
changeRecordProducerGr.orderBy(orderBy);
// END OF MODIFIED CODE THAT ENSURES CARDS ARE SORTED IN ORDER
changeRecordProducerGr.query();
}
return changeRecordProducerGr;
};
Thanks!
0 REPLIES 0