Search/Filtering Logic for custom field type

Hello, I’m having some trouble trying to figure this by myself.

I have a custom field type on my CRM and I was trying to add some custom functionality to it. I was trying to make it work in the search form in the list view (advanced and basic search). For that I need to specify how this type of field is filtered by the CRM. More specifically, it is something similar to the multienum field, but it’s values are delimited by commas instead.

Is it possible to program this functionality somewhere in the CRM in a generic way? (By generic I mean that works on any module).

My suitecrm version is 7.13 right now.

Thanks for your help beforehand.

Have a look at SugarField customizations, try searching the forums for that.

I couldn’t find anything on the forums.
I’ve been debugging the way the CRM filters the results. It seems like it is using the class SearchForm2 which uses the function generateSearchWhere(). On that function checks the field type directly.
Maybe if we could create that function on custom and add the custom code needed.
Any ideas? Or am I missing something else?

Also, this function is called from include/MVC/View/views/view.list.php

You said you had a custom field type. That notion corresponds to SugarFields.

Having a custom field is much simpler, you can do it from Studio. But it’s not a generic field type that you can use from every module.

I am not sure how this all connects to filtering. Maybe it doesn’t. But I am guessing it does, I am guessing that the SugarField class has a place to override how searches are handled.


These “Base” files get used when there are no overrides in the specific field types.

Here you have an example of adding a new field type:

Sorry if I confused you. Yes I meant a new SugarField.

From what I could find, there seems to be 4 functions in SugarFieldBase.php that could implement this functionality but they aren’t called by the CRM. Those are getSearchInput, getQueryLike, getQueryIn and getSearchWhereValue. None of those gets called when I do a search with advanced search on Accounts module.

I’ve also found some classes in include/generic/SugarWidgets where some queries are defined for each type, but again it’s not being called on the advanced search. Those classes probably are used by the Reports module.

It seems the CRM doesn’t have a mechanism for that, but I could be missing something.

You’re right, those functions don’t seem to be used anywhere…

I don’t know the answer to what you’re asking, but I had a look around Github for some older PR’s I remembered.

Maybe that can give you clues about which files to change when trying to customize search behaviours… I hope it helps.

If you solve it, please come back here and post your solution!