Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sugarcrm sortable by lastname instead of name

I have a related field in a custom module that links to a contact. If I activate sorting for this field (listviewdefs.php: sortable=>true) sorting works correctly by using the name field of the contact.

How could I sort by the last_name and then the first_name instead?

like image 242
pauel Avatar asked Dec 07 '25 22:12

pauel


1 Answers

If first_name and last_name both are db fields then you can apply sorting on listview just like name field (listviewdefs.php: sortable=>true). You only need to add this code

first_name' => array( 'query_type'=>'default'), 'last_name' => array( 'query_type'=>'default'),

in searchFields.php file.

like image 90
Muhammad Saad Shahid Avatar answered Dec 09 '25 11:12

Muhammad Saad Shahid