Wednesday 9 April 2014

[vTiger 6] How to change default fields on popup ListView

When I need to select some item of a vTiger module from other, a popup window is opened. A list of items appears with a columns by default but we can't choose them from GUI. We need to change the code. 

The following example changes the columns for Products module. We are going to add two new columns to the view, the Serial Number and the Category of the product:




  • Go to /vtigercrm/modules/Products
  • Open Products.php with a editor
  • Search the following lines:
var $search_fields = Array(
'Product Name'=>Array('products'=>'productname'),
'Part Number'=>Array('products'=>'productcode'),
'Unit Price'=>Array('products'=>'unit_price')
);
    var $search_fields_name = Array(
    'Product Name'=>'productname',
    'Part Number'=>'productcode',
    'Unit Price'=>'unit_price');

    and replace with:


    var $search_fields = Array(
    'Product Name'=>Array('products'=>'productname'),
    'Serial Number'=>Array('products'=>'serial_no'),
    'Part Number'=>Array('products'=>'productcode'),
    'Product Category'=>Array('products'=>'productcategory'),
    'Unit Price'=>Array('products'=>'unit_price')
    );
      var $search_fields_name = Array(
      'Product Name'=>'productname',
      'Serial Number'=>'serial_no',
      'Part Number'=>'productcode',
      'Product Category'=>'productcategory',
      'Unit Price'=>'unit_price');



      Be careful with the name of the fields that you want to add. If you check the name of Serial number field on vtiger_products table of mysql, this name is serialno, but the name of this field on Products class is serial_no. The relationship between this fields is in vtiger_fields table, check on it always this association.

      You can use the same procedure to add columns on any other module as HelpDesk(Trouble Tickets), Services, Organizations...

      4 comments:

      1. Thanks! Works perfectly :)

        ReplyDelete
      2. Note, you can change the default fields on popup ListView without having to modify core code. The fields that have been configured to be presented on Summary View will be the fields that are presented on popup ListView.

        To add/remove a field from Summary View-:

        1. Click the cog wheel in the top-right hand corner and select CRM Settings
        2. Expand 'Studio' from the Settings menu and select Edit Fields
        3. Select module to edit from the drop down menu
        4. Hover cursor over a field you wish to edit and then click the pencil icon.
        5. Check/Uncheck "Summary View" and then click the Save button

        ReplyDelete
      3. Hi, I have checked above code and it won't works for vtiger 6.5 version. Please help to solve this.

        Regards,
        Krishnaprasad PB

        ReplyDelete