7.5 Filters: how do I add "is any of" to the options for a field in a filter?

In Opportunities I would like to change the filter on assigned to from is/is not to is any of/is not any of.

Where would I go to change that definition?

thanks,
FrancescaS
  • Are you searching filter settings?

    clients/base/filters/operators/operators.php

    $viewdefs['base']['filter']['operators'] = array(    'multienum' => array(
            '$contains' => 'LBL_OPERATOR_CONTAINS', // is any of
            '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',
        ),
        'enum' => array(
            '$in' => 'LBL_OPERATOR_CONTAINS', // is any of
            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',
        ),
    ...
    ...
  • I should have updated this as well as https://community.sugarcrm.com/thread/20056

    Changing the filter setting is not enough, I get the 'in' option on the assigned to but I can't enter multiple selections for it.

    Note that assigned_to is a relate field.

    thanks,
    FrancescaS
  • Hi FrancescaS,

    I had a somewhat same customization before. i had a flex relate field and they want to search without the need to select a module. So what i did was add the flex relate to the filter
    <root>/modules/<myMod>/clients/base/filter/default/default.php

    Then i created a logic hook before_filter that would help you insert or modify the sugarquery being used before it is actually run.

    Hope this idea helped you
  • Hi FrancescaS,

    This post has helped me a lot and now I find myself having the same problem - how to enter multiple selections for the assigned to.

    Were you able to make it work?

    Thanks in advance.
  • Hi everyone,

    The ability to filter on multiple assigned users is being added to 7.7. The assigned to filter will have the "Is any of" and "Is not any of" options instead of the "Is" and "Is not" options. Similar functionality is being added to relate-type fields too. For example, you can search for multiple related accounts on the contacts list view.

    Please follow the releases category in the community to be alerted when 7.7 releases.

    I hope this helps!
    Alex

  • Will the filter 'is any of' be available for teams in the same release?
  • Hi Everyone,

    I Think , I got the answer for your Questions .

    Copy operators.php file (Location::: clients/base/filters/operators/operators.php) and create a custom file  and paste operators.php file  inside (Location :: custom/clients/base/filters/operators/operators.php).

    and  add  "require_once('clients/base/filters/operators/operators.php'); " in custom operators.php file and now you can change values based on your requirements

    Example:

    require_once('clients/base/filters/operators/operators.php');

    $viewdefs['base']['filter']['operators'] = array(

        'multienum' => array(

            '$contains' => 'LBL_OPERATOR_CONTAINS',

            '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',

             '$in' => 'LBL_OPERATOR_CONTAINS',

            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',

        ),

        'enum' => array(

            '$in' => 'LBL_OPERATOR_CONTAINS',

            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',

        ),

        'varchar' => array(

            '$equals' => 'LBL_OPERATOR_MATCHES',

            '$starts' => 'LBL_OPERATOR_STARTS_WITH',

            '$in' => 'LBL_OPERATOR_CONTAINS',

            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',

            '$contains' => 'LBL_OPERATOR_CONTAINS',

            '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',

        ),

        'name' => array(

            '$equals' => 'LBL_OPERATOR_MATCHES',

            '$starts' => 'LBL_OPERATOR_STARTS_WITH',

            '$in' => 'LBL_OPERATOR_CONTAINS',

            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',

            '$contains' => 'LBL_OPERATOR_CONTAINS',

            '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',

        ),

    ......

    Finally, we can now navigate to Admin > Repair > Quick Repair and Rebuild

    now we can search for multiple related accounts on the contacts list view also.

    I did for

      'name' => array(

            '$equals' => 'LBL_OPERATOR_MATCHES',

            '$starts' => 'LBL_OPERATOR_STARTS_WITH',

            '$in' => 'LBL_OPERATOR_CONTAINS',

            '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',

            '$contains' => 'LBL_OPERATOR_CONTAINS',

            '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',

        ),

    PFA

    filter.png

    I hope this helps!

    Thanks

    SK

  • Hi

    Have tried your method and it works but It looks like the new operates still behave like the original ones for their field type.

    Example Lead Source is a drop down list but when we allow it to be filtered by Starts with you still get a drop down list and trying to put in Partial works wont work like 'Bra' for 'Brand'. Typing in anything wont work and you need to pick from the drop down list.

    We are on SugarCRM Enterprise, Version 7.9.2.0 (Build 1090). Are there extra options we need to set?