Sort order in catalog

ckube
Tera Expert

We are building out our catalog (have not gone live with it yet) and it is fairly large with quite a lot of categories and catalog items.   I am wondering how you folks are sorting your catalog items within each category?   Do you do it alphabetically by name, some dynamic type of sort order, etc?   Details would be great.   I do realize I can use the order number field on each catalog item but it seems unrealistic to do that with such a large catalog - and having to maintain that with each new item entered, edited, etc.   Any advice, suggestions?

10 REPLIES 10

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Cindy,



I think the only way you can sort is with the help of order field on catalog item which you are aware


Please let me know if you have any questions.


Support mentioned that it could be controlled/ordered via a business rule, but I haven't attempted that yet.   I just can't imagine why it would be so difficult (or unusual?) to sort the catalog items within a category alphabetically.   That is why I was wondering what everyone else is doing.


johnstettin
Tera Expert

We also have a rather large catalog and have found maintaining the order numbers can become rather difficult. To overcome this we created a business rule to auto re-orders the items on insert or update. This has proven to be extremely helpful for our admins and especially the users.



Table: Catalog Item [sc_cat_item]


When: After - Insert/Update



Script:


function onAfter(current, previous) {


    //This function will be automatically called when this rule is processed.


    gs.addInfoMessage("Please wait, re-ordering the Service Catalog");


    var gr = new GlideRecord('sc_cat_item');


    var i = 0;


    gr.orderBy('name');


    gr.query();


    while(gr.next()){


          gr.order = i;


          gr.update();


          i++;


    }


}


tomas55555
Tera Contributor

We have our catalog sorted by alphabet. But if there are items which you prefer to have on the top you can define the "order" and set them up like:


"-100" - first on my list


"-50" - second on my list


...etc.


Thanks to this you don't have to define an order for each item.