Business rules to sort the Records in a Table ?

katz2
Tera Contributor

Hi Folks !

Is there any business Rule to sort the records in the Table which shows the latest data first. or is there any other option to achieve the same.....

Thank you !

2 REPLIES 2

marcguy
ServiceNow Employee
ServiceNow Employee

check this wiki article out, describes how to set order on your modules and lists


Controlling the Sort Sequence Used to Display Lists - ServiceNow Wiki


srinivasthelu
Tera Guru

Hi Karthik,



Are you wanting to sort the records in the list view or while writing the GlideRecords in script?



You can technically achieve what you want by a query business rule with script something like below.



(function executeRule(current, previous /*null when async*/) {




  // Add your code here



  current.addQuery('ORDERBYshort_description');   // short_description is the sample field that i have selected




})(current, previous);




But i really do not understand the purpose of this use case.



Thanks


Srinivas