Create Custom Filter to Cases

Hi Everyone!

I need to create a custom filter module for cases.

The "cases" module has a relationship with the "accounts" module, so the custom filter should show in my "cases" list view, only the records that its relationship with "accounts" its label "user assigned to" is equal to the current logged in user.

Actually I have this code:

global $current_user;
$viewdefs['Cases']['base']['filter']['basic']['filters'][] = array(
    'id' => 'filterCasesAccounts',
    'name' => 'LBL_FILTER_CASES_ACCOUNTS_TEMPLATE',
    'filter_definition' => array(
        array(
            'account_cases' => array(
                '$in' => array(
                    'assigned_user_id' => array(
                        '$equals' => $current_user->id,
                    ),
                ),
            ),
        ),
    ),
    'editable' => false,
    'is_template' => false,
);
How could I do this filter?
Thank you!
Parents
  • I didn't try that before, but perhaps it works:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    $viewdefs['Cases']['base']['filter']['basic']['filters'][] = array(
    'id' => 'filterCasesAccounts',
    'name' => 'LBL_FILTER_CASES_ACCOUNTS_TEMPLATE',
    'filter_definition' => array(
    array(
    '$owner' => 'accounts',
    ),
    ),
    'editable' => false,
    'is_template' => false,
    );
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regargs

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André.

    Thank you so much!
    Your code works succesfully, It was what I needed.

    Regards

Reply Children
No Data