phpsugarcrmsugarbean

Implementing a custom filter in SugarCRM based on relationship ID


I've defined a many-to-many relationship between Accounts and a custom module (Tags). Tags have a subpanel in Accounts; however, I need a custom filter on Accounts that will show all the Accounts records related to the Tag name you type in.

/custom/Extension/modules/Accounts/Ext/clients/base/basic/filterAccountsByTag.php

$viewdefs['Account']['base']['filter']['basic']['filters'][] = array(
    'id' => 'filterAccountsByTag',
    'name' => 'LBL_FILTER_ACCOUNTS_BY_TAG',
    'filter_definition' => array(
        array(
            'custom_tags_accountscustom_tags_ida' => array(
                '$equals' => ' ',
            ),
        ),
        array(
            'name' => ''
        )
    ),
    'editable' => false,
    'is_template' => false
);

To sum it up, I want to display the primary module results based upon a filter from a sub-module. Has anyone been through this? This is not a relate field; it's a relationship.


Solution

  • I hope this below article will help you.

    Apply initial filter in relate fields and relationship fields with quick(popup) search sugarcrm 7.x