Mochabomb

Web Design and Technical notes

Mochabomb header image 2

VTiger - sort by custom columns

March 19th, 2007 10:13 pm · 3 Comments

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.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Tags: vTiger

3 responses so far ↓

  • 1 aditive // Feb 26, 2008 at 2:22 am

    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 // Jul 11, 2008 at 12:18 am

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

  • 3 Gregg // Jul 12, 2008 at 11:55 am

    Sure thing - glad to help!

Leave a Comment