Issue with sorting the records

Sujatha V M
Kilo Patron
Kilo Patron

Hi Team, 

 

I'm facing an issue in sorting the records. 

 

For eg. I have 6 records of different change types and their count like "Normal - 2", "Emergency - 1", "Standard - 3". 

 

I don't want the sort based on alphabetical asc or desc. I want customized sort to be as Normal - Standard - Emergency.

 

How to get the records on a custom sort?  

 

Any help or idea is appreciated. 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.
7 REPLIES 7

@AshishKM Thank you for your inputs but custom field creation isn't allowed hence didn't go ahead with your approach. 

 

I had used script include and implemented the logic to sort and concatenate. It was listing the records as expected. 

 

Once again thank you for your help rendered towards it. 

 

Thanks, 

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Thanks for reply, would you like to share this custome implementaion.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

@AshishKM  Sure! Why not!

 

The approach I had used here is, all these change requests are listed as agenda items on the CAB Workbench which shows up in a mixed view conducting the CAB meeting and weren't aligned.

(i.e) based on the order but not based on types and custom field. 

 

1. Fetched all the change records and stored it in an array. 

2. Used "for loop" to fetch the records based on change type and sort within the loop based on alphabetical order for the custom field value and they are saved in another array. 

3. Concatenate the sorted arrays in the order we would like to display. 

E.g. var allRecs = [];

allRecs = emergency.concat(normal, standard)

4. Following which the order is set to display. 

 

Results in the CAB Workbench under all pending items, will show as "Emergency - Normal - Standard" types with an incremental order along the custom field values in alphabetical order. 

 

Thanks, 

Sujatha V.M.

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.