How to Change The Default Ticket Order In ListView

The example was created using Vtiger v7.1 code base. The later versions do have the same "sorting function", however the line number might be different.

Vtiger Version: v7.1

File: /modules/Vtiger/models/ListView.php

Line: 245~

Full Diff: listviewSortOrderVtiger7.html (scroll down to line 245)

Code to be added

} else if(empty($orderBy) && empty($sortOrder) && $moduleName = "HelpDesk"){
	$listQuery .= ' ORDER BY vtiger_crmentity.modifiedtime DESC';
	// You can sort by 3x values:
	// vtiger_crmentity.modifiedtime
	// vtiger_crmentity.createdtime
	// vtiger_crmentity.crmid

Explanation

Screenshot: https://s3.vtexperts.co/224/t/10/20/7A5t6W723U6H6T4v4Z.png

  1. Is what I added (new code)

  2. Is where I copied from

  3. Specifies the module, so in this case, it will only apply to Tickets (HelpDesk is the actual module name).

  4. Use the fields from vtiger_crmentity for sorting.

Last updated