I came across this interesting issue in the forums the other, where the poster was trying to add a search field that would search the for Calls based upon the associated Account’s billing address postal code. This is a pretty straightforward upgrade-safe customization that should work fine on most recent versions of Sugar ( although I’ve only tested it on the latest 6.2.0beta ).
There are two parts to this customization. The first part requires us to add the search field definition in the custom/modules/Calls/metadata/SearchFields.php.
The key here is the subquery we’ve defined, which looks for all the accounts with the matching postalcode given in the search input. The actual postal code we are searching for is appended to the query specified with an ‘%’ appended to the search term. In the end, the where clause addition that gets generated looks something like this if we were searching for postal code 40323:
Now we just need to add this to the search form. We can do this by copying the modules/Calls/metadata/searchdefs.php file to the custom/modules/Calls/metadata/searchdefs.php and adding an entry like this to under either the ‘basic_search’ or ‘advanced_search’ array keys in whichever position you wish to have the input field listed.
Now the search field will be listed in the search form and be available for all your users to use.