Custom filter by teams

Hi everyone,

I am trying to create a new custom filter that filters by teams in some module's list views (accounts, cases, contacts and opportunities). I defined those filters like this example:


$viewdefs['Opportunities']['base']['filter']['basic']['filters'][] = array(
    'id' => 'filterTeamsOpportunities',
    'name' => 'LBL_FILTER_TEAMS',
    'filter_definition' => array(
        array(
            'team_name' => array(
                '$in' => array(),
            ),
        ),
    ),
    'editable' => false,
    'is_template' => true
);

I also tried placing the custom filter in its own path rather than in the "basic" path, and not to use the Extension framework:

custom/Extension/modules/Opportunities/Ext/clients/base/filters/basic/filterTeamsOpportunities.php

to something like

custom/modules/Opportunities/clients/base/filters/filter-by-team/filterTeamsOpportunities.php

and then updated the array accordingly, like:

$viewdefs['Opportunities']['base']['filter']['filter-by-team']['filters'][] = array(

I have not been able to make it work in these ways. Has anyone tried to do something like this?

Thanks in advanced!

  • Hi Alberto,

    following the steps from this doc below you should be able to create a custom filter : https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Architecture/Filters/index.html#Adding_Initial_Filters_to_Lookup_Searches

    Make you are add the correct field names on the file. 

    //JS

     

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    this._filterOptions = new app.utils.FilterOptions()
    .config({
    'initial_filter': 'filterTeamsOpportunities',
    'initial_filter_label': 'LBL....',
    'filter_populate': {
    'team_name': {
    //correct filter
    },
    }
    })
    .setInitialFilter('...')
    .populateRelate(this.module)
    .format();
    return this._filterOptions;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Rodrigo Manara

    Sr. Developer

  • Hi Rodrigo,

    Thank you for your answer! I tried with the documentation guide and we have many other filters working in the same project, done as described in the documentation. The problem is that this doesn't work for the team field.

    Best regards.