AnsweredAssumed Answered

Why is ORDER BY used when I am not using it in my query to create a custom subpanel?

Question asked by Navneet Golwalkar on Apr 15, 2014
hello guys,
i am trying to add a custom Contacts Subpanel in Accounts Module, all goes right but data is not coming because of (ORDER BY contacts.id asc LIMIT 0,51: MySQL error 1054: Unknown column 'contacts.id' in 'order clause'),even i am not including ORDER BY in my query ,here are some code and screenshots

CODE:custom\modules\Accounts\customcontact.php

function cust_cont_c(){

$return_array ['select'] = " SELECT contactcurrency_c";
    $return_array ['from'] = " FROM contacts_cstm ";
$return_array = $return_array ['select'] . ' ' . $return_array ['from'];
   
    return $return_array;
}
?>

CODE:custom\Extension\modules\Accounts\Ext\Layoutdefs\accounts_contact_c.php

<?php $layout_defs['Accounts']['subpanel_setup']['cust_cont_c'] =

        array(
             'order' => 100,
            'module' => 'Contacts',
            'subpanel_name' => 'Account_subpanel_contacts',
            'get_subpanel_data' => 'function:cust_cont_c',
            'title_key' => 'LBL_CUST_CONT',
            'function_parameters' => array(
             'import_function_file' => 'custom/modules/Accounts/customcontact.php',
            ),
);


CODE:custom\modules\Contacts\metadata\subpanels\Account_subpanel_contacts.php

$subpanel_layout['list_fields'] = array (  'contactcurrency_c' => 
  array (
    'name' => 'contactcurrency_c',
    'vname' => 'LBL_ID',
    'widget_class' => 'SubPanelDetailViewLink',
    'module' => 'Contacts',
    'width' => '25%',
    'default' => true,
  ),
  'contactrecordtype_c' => 
  array (
    'name' => 'contactrecordtype_c',
    'vname' => 'LBL_CUST_CONT',
    'width' => '15%',
    'default' => true,
  ),
  
);

SCREENSHOT:



And in sugarcrm.log the erroe comes......04/14/14 15:25:27 [10740][76630d8d-de9f-b2a6-3923-52aede86590f][FATAL] Error retrieving Account list:  Query Failed: ( SELECT contactcurrency_c  FROM contacts_cstm ) ORDER BY contacts.id asc LIMIT 0,51: MySQL error 1054: Unknown column 'contacts.id' in 'order clause'


Outcomes