Module Contracts - Pop Up - Editing a query within a pop-up? - Filtering

Guys, I'm having trouble relating the module "Contracts" with a custom module named "address" that is also related to "accounts".

Since I already have filled the bill, I wanted to open the pop-up charges is only the "addresses" that linked "Account".

When I do research within a "pop-up" lists all the addresses, my question is how could I do this filtering, someone has been there?

Thanks,

Some images:

imagem1.JPG

imagem2.JPG

imagem3.png

  • Hi Bruno

    You can apply an initialFilter on popup, but it will only work on first popup rendering. Just after applying any other filter or paginate it then the initialFilter will reset to all records.

    Another approach would be render it on editview as a regular dropdown. Inside controller action_editview you can force the dropdown options based on related Account. Inside the same method action_editview you can update the type of field in order to become a regular dropdown field. This will apply to editview only, any other view will remain intact.

    Kind regards

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

    I did like how the example below filtering by name, was more or less the solution I wanted, but needs to be done with the Account ID.

    https://community.sugarcrm.com/message/62142#62142

    imagem1.png

    ./custom/Extension/modules/Contracts/Ext/Layoutdefs/contracts_aaa_endereco_1_Contracts.php

    //Change line:

    'top_buttons' =>

       array (

        0 =>

        array (

          'widget_class' => 'SubPanelTopButtonQuickCreate',

        ),

        1 =>

        array (

          'widget_class' => 'SubPanelTopSelectButton',

          'mode' => 'MultiSelect',

          'initial_filter_fields' => array(

      //  'account_id' => 'aaa_endereco_accounts_name_advanced', 

          'account_name' => 'aaa_endereco_accounts_name_advanced', 

       ),

        ),

      ),

    ./modules/aaa_Endereco/metadata/popupdefs.php

    //My field to search:

    'aaa_endereco_accounts_name' =>

      array (

        'type' => 'relate',

        'link' => true,

        'label' => 'LBL_AAA_ENDERECO_ACCOUNTS_FROM_ACCOUNTS_TITLE',

        'id' => 'AAA_ENDERECO_ACCOUNTSACCOUNTS_IDA',

        'width' => '10%',

        'name' => 'aaa_endereco_accounts_name',

      ), 

    But when the step account_id is this way,

    imagem2.png

    I should change in some other place or places? ^^

    If you have any examples would be helpful!

    Thanks

  • guys I could not edit the search form or the query , then created a new widget with a drawer that adds relationship via REST , I do not think it's a good practice , but it was the only way that worked for me .

     

    print1.JPG