Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

SuiteCRM default filter on opportunities

I’m running SuiteCRM v7.10.7 on Win11 on Chrome browser. I’d like to set a default filter for my opportunities, but I don’t see this option. Every time I click opportunities I want the view to be automatically filtered based on a filter that I define in “my filters” drop down list. I want to click “opportunities” and have the list displayed as filtered. Is there a way to do this?

Hmm, the default behaviour should be that the listview should save the last search you made (which I assume is one of your filters). I can confirm this using the lastest version (using demo).

Check your config.php and config_override.php and confirm that the setting save_query is set to all

'save_query' => 'all',

Then let us know what steps you are taking to creating your filters and using them (just in case you’re missing a step).

Hello and thank your for your quick reply. According to the SuiteCRM documentation, the config.php and config_override.php files should be in the SuiteCRM root directory. I’ve searched my C drive and don’t have a “SuiteCRM” directory. I run SuiteCRM from within a browser. I’m sorry for such a basic question, but can you direct me to the directory in which I’ll find these two files?

Thank you.

IT person helped me locate these files. We found that ‘save_query’ => ‘all’ is set in the config.php file, but this line of code doesn’t exist in the config_override.php file.

My steps to establish the filter are: click sales, choose opportunities. List is configured based on an existing filter (not sure why). Click little red “X”, click “My Filters” dropdown and choose a filter that I saved “opps after 2022Q1”.

Filter is: Opportunity value “greater than” 50000, Expected close data after “4/1/2022”, Order column by “close”, ascending.


Thanks for the extra detail. That’s good that the save_query is set in config.php (it only needs to be appear in one or the other). So that should save your last filter when you view a module. That sort of acts as a “default” filter. When you say “List is configured based on an existing filter (not sure why).” that is exactly what the save_query is doing. It remembers the last query/filter you used on the module’s list view. So if you ran your filter “opps after 2022Q1”, see the filtered results, navigate away to another module, return back to opportunities list view, it should still have you “opps after 2022Q1” filter applied. That should also work if you log out and log back in again (I suspect depending on the length of time though).

When I exit the filtered list and return to it, the previous filtered list is still there. Oddly, when I choose the “my filters” drop down list, the "opps after 2022Q1 has a “check mark” next to it as shown below. But the results for this filter are not shown. If I click the red “x” the “my filter” list is reset and I can choose “opps after 2022Q2” and the resulting filtered list is as expected. Suggestions to resolve this behavior are welcome.

As mentioned there doesn’t seem to be an option besides getting used to choosing a filter every time the filter is cleared.
Using custom coding it might be possible. I have just done this with a custom module, but I suppose it should be similar for the Opportunities module.
This requires creating a file in the suitecrm directory /custom/modules/ModuleName/views/view.list.php
and overriding the listViewProcess() function.
The code checks if a default query has been requested and for a ‘button’ value not to be assigned since it usually means a custom query is being used (not sure if all of it is necessary but works for my use-case).
Hope this helps others who find this through search.



class ModuleNameViewList extends ViewList {

    function listViewProcess() {

        $this->lv->searchColumns = $this->searchForm->searchColumns;

        if (!$this->headers) {

        //custom check if request is default (no search filters). if so, use our custom defaults
        if (empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query'] == 'true')) {
            $this->params['custom_where'] = " AND modulename.fieldname ='value' ";//this should reflect what your default query should be.

        if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
            $this->lv->ss->assign("SEARCH", true);
            $this->lv->ss->assign('savedSearchData', $this->searchForm->getSavedSearchData());
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
            echo $this->lv->display();

1 Like

Thank you for your suggestion and the clear code example. I don’t have access to our server side. I’ve forwarded this to our IT person who has access. We’ll give this a try and let you know.

Thank you for your suggestion. Sadly, this seems to have effect. Per your instructions we produced the .php file and place it in the directory that you suggested. This doesn’t resolve the problem. You can duplicate this error by creating a custom filter. In my case, I used the filter settings show in the screen shot. Save and close the filter. Query the database on anything using the main search box the nature of the search doesn’t matter. Click the filter drop down and notice that a check mark already exists next to your filter even though no filter has been run. Clicking the filter will not do anything. Click the red box, thereby clearing the filter. Now filter again and all is good. I want the last filter that I used to be persistent until I change it and this is the problem.