Sort the items shown in the left side of Slush bucket by 'Order' field

RamNithinD
Tera Contributor

The current default feature of slush bucket is to show the items in alphabetical order. But we have a requirement to show fields in order by the field called 'Order'. Is there any way to achieve this?

We have created a m2m table for two tables called 'Question' and 'Frequency'. Question has a related list where you can see all the frequencies associated with it(basically the data from m2m). There you have the 'Edit' button, when clicked on, it opens the slush bucket with list of Frequencies on left side. We want to that list to be in a specific order based order field.

This is how looks now(Alphabetical order):

RamNithinD_0-1766057144555.png


We want in this order (this data is from Frequency table list view):

RamNithinD_1-1766057218217.png

 



11 REPLIES 11

Brad Bowman
Kilo Patron
Kilo Patron

You can alter the UI Action so that it has a default query, which in this case would only be the sort order.  To do this you will want to first copy the out of box Edit UI Action for m2m to display on each Related List table.

 

Find the UI Action record named Edit... on the global table that has the Comment Many to Many.  Change the name (temporarily so you know you have the right one) change the table to one of the related lists, then Insert & Stay.  Check the Related List to make sure the new name appears instead of Edit...

 

Now on the new UI Action record you can change the name back to Edit... or whatever you want, then add some lines to the Script section - before the if statement

uri.set('sysparm_query', 'ORDERBYu_order');
//uri.set('jvar_no_filter', 'true'); 

where the first line is your encoded query and the second is optional, to hide the filter from above the slushbucket boxes.

 

Once you have this working on one Related List, Insert & Stay on the new UI Action after changing the table to the second Related List. 

Ankur Bawiskar
Tera Patron
Tera Patron

@RamNithinD 

I agree with what @Brad Bowman  mentioned.

Adding my thoughts

-> you can override the Edit button in related list present on global table and then add your logic to sort by passing in query

-> I shared solution on how to override the Edit button here, check that and enhance

How to hide Display filter after clicking edit button in related list 

AnkurBawiskar_0-1766064096694.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

RajiniM
Tera Expert

Hi @Brad Bowman  and @Ankur Bawiskar 
Thank you for the reply 
I have tried the solution and I could see order filter on the page, but the data is still following the alphabetical order

RajiniM_0-1766067728971.png

 

If you change the drop-down to z to a, then back, or delete it with the red x and add it manually does it change at all? Did you specify the correct field name in the ORDERBY clause?