SugarCRM custom search by query

SugarCRM custom search by query

June 29, 2014 PHP SugarCRM Uncategorized 0
custom\Extension\modules\c_Debtor\Ext\Vardefs
koi pan field ma lakhi devanu
<?php
 // created: 2014-06-06 11:41:24
$dictionary['c_Debtor']['fields']['s_c']['labelValue']='s';
$dictionary["c_Debtor"]["fields"]["test"] =
array(
'name' => 'test',
'vname' => 'test',
'type' => 'varchar',
// function to call that will return html that will be inserted
'function' => array('name' => 'test', 'returns' => 'html', 'include' => 'custom/modules/c_Debtor/dropdown.php'),
'required' => false,
'do_report' => false,
'reportable' => false,
'comment' => 'Currency in use for the campaign',
'source' => 'non-db'
);
 ?>
after that
custom/modules/modulename/dropdown.php
<?php
function test($focus, $field, $value, $view){
$html = '<option value="market">Market</option>
  <option value="test">Test</option>
  <option value="test2">Test2</option>
  <option value="test3">Test3</option>';
return $html;
}
custom/modules/modulenbame/metadata/searchdefs.php
<?php
$module_name = 'c_Debtor';
$searchdefs [$module_name] =
array (
  'layout' =>
  array (
    'basic_search' =>
    array (
      'search_name' =>
      array (
        'name' => 'search_name',
        'label' => 'LBL_NAME',
        'type' => 'name',
        'default' => true,
        'width' => '10%',
      ),
 array(
'name' => 'test',
'label' => 'test field',
'type' => 'enum',
),
   's_c' =>
      array (
        'type' => 'enum',
        'default' => true,
        'studio' => 'visible',
        'label' => 'LBL_S',
        'width' => '10%',
        'name' => 's_c',
'db_field' =>
    array (
      0 => 's1_c',
      1 => 's2_c',
custom/modules/modulename/SearchFields.php
  'do_not_call' =>
  array (
    'query_type' => 'default',
    'input_type' => 'checkbox',
    'operator' => '=',
  ),
  'test' => array(
'query_type' => 'default',
'operator' => 'subquery',
'subquery' => 'SELECT id_c FROM c_debtor_cstm WHERE  c_debtor_cstm.s2_c LIKE',
'db_field' => array('id'),
'type' => 'enum',
),
note: s1_c and s2_c is other dropdowns in this moduels.

Leave a Reply

Your email address will not be published. Required fields are marked *