VTiger – sort by custom columns

March 19, 2007 by gregg Leave a reply »

Today I added a custom column to our vtiger install we use at Direct Finance – a custom data field: Loan Purpose. I added this custom field to Accounts, Leads and Contacts and Potentials – then mapped them to eachother (so data was kept as lead was converted).

Now in looking at leads, accounts, or contacts, I want to sort by that new field – but it’s not sortable by default – neither are the created and modified times – would be useful to sort by date modified or created…

1. Using phpmyadmin ( or something like it ) find the field name in the table of interest – for vtiger_accounts it was a new custom field called cf_461 – make sure to use the database field name, not the field label.

2. Edit Accounts.php, Contacts.php, and Leads.php (note the file name is the module name ending in “s” ) this is the line to modify:
var $sortby_fields = Array('accountname','city','website','phone','smownerid');
to something like:
var $sortby_fields = Array('cf_461','createdtime','accountname','city','website','phone','smownerid');

Now you can sort by your new custom field – or any field in that module when a custom view is created.

  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit
Advertisement:

3 Responses

  1. aditive says:

    thank you! exactly what I was looking for.

    I found the custom fields for “Accounts” in the table called “vtiger_accountscf”.

    And the accounts.php is of course in “modules/Accounts/” (just in case someone can’t find it;)

  2. Matas says:

    Thanks dude, thats just what i needed to sort my trouble tickets by time created

  3. Gregg says:

    Sure thing – glad to help!

Leave a Reply


Mochabomb is Digg proof thanks to caching by WP Super Cache