Always add a wildcard at beginning of a search term

There was a question on the SugarCRM forums today that asked if anyone has found an upgrade-safe way to customize searches to always add a % to the beginning of a search ( Being able to add a wildcard is useful if you are searching for something that may exist in the middle of a value and not necessarily at the beginning. For example, you know a lead you’ve been working on contains “Auto” in it, but you aren’t sure where. You can manually search for %Auto and it will return any lead that contains “Auto” anywhere in the name. (FYI – the search wildcard is always added to the end of a search)

Some would prefer that the search always act this way. In the past, a hack had to be done to include/SearchForm/SearchForm2.php. Since that time, SugarCRM has added a global config option. Simply add the following to your config_override.php:

'search_wildcard_infront' => true,

There are tons of undocumented or hard to find documentation on options such as this. If enough people would find it useful I’d be willing to take a shot at writing a parser that extracts nuggets such as this from the code.


I make high quality solutions at an alarming rate.

8 Responses to “Always add a wildcard at beginning of a search term”

  1. Jeff November 30, 2012 at 9:32 pm # Reply

    Here is a link to all of the 6.4 sugar_config variables

    • jason November 30, 2012 at 9:58 pm # Reply

      So cruel! Any way to get something like this public? How did you go about collecting all of them?

    • Matthew Poer November 30, 2012 at 11:19 pm # Reply

      THIS IS A THING? Just to reiterate, a complete list of these would be awesome, and the documentation just isn’t out there right now.

    • Matthew Poer November 30, 2012 at 11:19 pm # Reply

      Requesting access!

  2. Mayer Elyashiv January 6, 2013 at 10:40 am # Reply

    Requesting access

  3. Graveworm April 5, 2013 at 5:06 am # Reply

    Thank you!

  4. razvan February 24, 2017 at 9:09 am # Reply

    Is this still workling in sugat 7.7 :(((
    Added it to config_override.php like so
    $sugar_config[‘search_wildcard_infront’] = true
    but nothing changed inside sugar

    • jason February 24, 2017 at 11:21 am # Reply

      There is a good chance this doesn’t work in 7.7 anymore. Sorry!

Leave a Reply