How to add the Custom Field to the Global Search/Elastic Search in SugarCRM Enterprise 12.0.1

Hello Everyone!
I was wondering if anyone knew how to implement or add a custom field to the global search. I created a custom selection-list in custom/modules/Accounts/clients/base/views/selection-list/selection-list.php, but still not work. Please check my sample code below:
<?php
$viewdefs['Accounts']['base']['view']['selection-list'] = array(
    'panels' => array(
        array(
            'name' => 'panel_header',
            'label' => 'LBL_PANEL_1',
            'fields' => array(
                array(
                    'name' => 'account_number_c',
                    'link' => true,
                    'label' => 'LBL_ACCOUNT_NUMBER_C',
                    'enabled' => true,
                    'default' => true,
                ),
                array(
                    'name' => 'name',
                    'link' => true,
                    'label' => 'LBL_LIST_ACCOUNT_NAME',
                    'enabled' => true,
                    'default' => true,
                ),
                array(
                    'name' => 'billing_address_city',
                    'label' => 'LBL_LIST_CITY',
                    'enabled' => true,
                    'default' => true,
                ),
                array(
                    'name' => 'billing_address_country',
                    'label' => 'LBL_BILLING_ADDRESS_COUNTRY',
                    'enabled' => true,
                    'default' => true,
                ),
                array(
                    'name' => 'phone_office',
                    'label' => 'LBL_LIST_PHONE',
                    'enabled' => true,
                    'default' => true,
                ),
                array(
                    'name' => 'assigned_user_name',
                    'label' => 'LBL_LIST_ASSIGNED_USER',
                    'id' => 'ASSIGNED_USER_ID',
                    'enabled' => true,
                    'default' => false,
                ),
                array(
                    'name' => 'email',
                    'label' => 'LBL_EMAIL_ADDRESS',
                    'enabled' => true,
                    'default' => false,
                ),
                array(
                    'name' => 'date_entered',
                    'type' => 'datetime',
                    'label' => 'LBL_DATE_ENTERED',
                    'enabled' => true,
                    'default' => false,
                    'readonly' => true,
                ),
            ),
        ),
    ),
);
I  tried also following this documention https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.1/Architecture/Global_Search, but still not working. Check my code below:
custom/modules/Accounts/clients/base/views/search-list/search-list.php
<?php
$viewdefs['Accounts']['base']['view']['search-list'] = array(
    'panels' => array(
        array(
            'name' => 'primary', // This is mandatory and the word `primary` can not be changed.
            'fields' => array(
                array(
                    'name' => 'picture',
                    'type' => 'avatar',
                    'size' => 'medium',
                    'readonly' => true,
                    'css_class' => 'pull-left',
                ),
                array(
                    'name' => 'name',
                    'type' => 'name',
                    'link' => true,
                    'label' => 'LBL_SUBJECT',
                ),
                'account_number_c',
            ),
        ),
        array(
            'name' => 'secondary', // This is mandatory and the word `secondary` can not be changed.
            'fields' => array(
                array(
                    'name' => 'email',
                    'label' => 'LBL_PRIMARY_EMAIL',
                ),
            ),
        ),
    ),
);
By the way my custom field is "account_number_c" and I`ve just copied the selection-list.php from Modules folder to Custom Folder.
Parents
  • Also, I already set the full_text_search enabled and unified_search to true  in the custom field vardefs. But still I am unabled to search using the custom field value in elastic search.

    <?php
    $dictionary['Account']['fields']['account_number_c'] =  array (
        'required' => false,
        'readonly' => false,
        'name' => 'account_number_c',
        'vname' => 'LBL_ACCOUNT_NUMBER_C',
        'type' => 'varchar',
        'massupdate' => true,
        'hidemassupdate' => false,
        'no_default' => false,
        'comments' => '',
        'help' => '',
        'importable' => 'true',
        'duplicate_merge' => 'enabled',
        'duplicate_merge_dom_value' => '1',
        'audited' => true,
        'reportable' => true,
        'unified_search' => true,
        'merge_filter' => 'disabled',
        'pii' => false,
        'default' => '',
        'full_text_search' =>
            array (
                'enabled' => true,
                'boost' => '1',
                'searchable' => true,
            ),
        'calculated' => false,
        'len' => '255',
        'size' => '20',
    );

Reply
  • Also, I already set the full_text_search enabled and unified_search to true  in the custom field vardefs. But still I am unabled to search using the custom field value in elastic search.

    <?php
    $dictionary['Account']['fields']['account_number_c'] =  array (
        'required' => false,
        'readonly' => false,
        'name' => 'account_number_c',
        'vname' => 'LBL_ACCOUNT_NUMBER_C',
        'type' => 'varchar',
        'massupdate' => true,
        'hidemassupdate' => false,
        'no_default' => false,
        'comments' => '',
        'help' => '',
        'importable' => 'true',
        'duplicate_merge' => 'enabled',
        'duplicate_merge_dom_value' => '1',
        'audited' => true,
        'reportable' => true,
        'unified_search' => true,
        'merge_filter' => 'disabled',
        'pii' => false,
        'default' => '',
        'full_text_search' =>
            array (
                'enabled' => true,
                'boost' => '1',
                'searchable' => true,
            ),
        'calculated' => false,
        'len' => '255',
        'size' => '20',
    );

Children
No Data