AnsweredAssumed Answered

Default search filter customization

Question asked by Caim Astraea on Feb 24, 2017
Latest reply on Feb 27, 2017 by Caim Astraea

A while back have changed the quicksearch_field to include more fields inside custom/modules/clients/base/filter/default/default.php 

$viewdefs['Accounts']['base']['filter']['default'] = array (

'default_filter' => 'all_records',

'quicksearch_field' => array('name', 'shipping_address_postalcode', 'shipping_address_city', 'ticker_symbol'), 'quicksearch_priority' => 2, 'default_filter' => 'all_records',

...... 

The problem I noticed is that the filter is definitely wrong by default is looks for records STARTING with my search term instead of records CONTAINING the term 

.../rest/v10/Accounts?view=list&fields=my_favorite,following&max_num=20&order_by=date_entered:desc&filter[0][$or][0][name][$starts]=SEARCHTERM&filter[0][$or][1][shipping_address_postalcode][$starts]=SEARCHTERM&filter[0][$or][2][shipping_address_city][$starts]=SEARCHTERM&filter[0][$or][3][ticker_symbol][$starts]=SEARCHTERM

 

Is it possible to search for records containing the search terms ? 

 

Update: I'm thinking could make a custom filter as described here Creating Custom Filters In Sugar 7 « Sugar Developer Blog – SugarCRM  but there's lots of info I don't have. 

In this example the '$starts' => 'A' is hardcoded how to pass it the value from my search ? 

Also is there a '$contains' ?  I'm thinking there could be such a filter.

Outcomes