Adding Custom Field to Global Search

Hi All,

I’ve added a custom text box field to the accounts module. Is there any way to add it the global search functionality. In other words global search would look for the criteria in the custom field as value.

Thanks!
Kevin

This can be done in the search definitions for a module. There are many guides online for this. Thanks, Will.

Hi,

I add a custom field to the contacts module.

custom/Extension/modules/Contacts/Ext/Vardefs/_Contacts.php


$dictionary['Contact']['fields']['code'] = array(
    'name' => 'code',
    'vname' => 'LBL_CODE',
    'type' => 'varchar',
    'len' => 10,
    'required' => true,
    'audited' => true,
    'unified_search' => true,
);

And used ‘unified_search’ => true, to make the field searchable using the global search.

I’ve done the repair and rebuild several times.

When I search for first name or last name every thing works fine.

But when I search a code, it does’t retrieve any record.

For example when I use the global search and search ‘1029’ I don’t retrieve any results :frowning:

And there is a contact record with this code poulated.

I’m using the global search.

The AOD never gives records I don’t know why…

I’ve run the cron.php several times too.

Can any one tell me how can I search globally the value of a custom field?

Hi,

Because AOD builds up an index for the search it means that if you change unified_search the field will only be added to the index after the record changes.

You can test for this by editing and saving a contact and then doing a search for the code.

In order to reindex you’ll need to remove the Index directory in modules/AOD_Index/Index and also delete any records in the aod_indexevent table. It may take a while for all records to be indexed again.

Hope this helps,
Jim

1 Like