How to create a subpanel in sugarcrm 7.6 in Accounts module.

Hi

   I want to create a subpanel,I have created an custom field-relatedaccount_c(related to accounts module)field in the Calls/Meetings/Tasks modules.This field appears only when the Parent Type="Projects" for the calls/Meetings/Tasks.So in the accounts module i want a Project Activities subpanel in which we can see all the list of calls/meetings/tasks whose parent type is Projects and  relatedaccount_c.Shijin Krishna Gustav Lindström Ajay Kumar

Parents
  • Hi Gustav

         Currently i am working on sugarcrm 7.6

         I have tried

    /<>/custom/Extension/modules/Accounts/Ext/Layoutdefs/test_subpanel.php

    <?php

    $layout_defs['Accounts']['subpanel_setup']['relatedaccount_c'] =

            array(order => 49,

                'module' => 'Calls',

                'subpanel_name' => 'Project Activities',

                'get_subpanel_data' => 'function:get_related_accounts',

                'generate_select' => true,

                'title_key' => 'LBL_RELATEDACCOUNT',

                'top_buttons' => array(),

                'function_parameters' => array(

                    'import_function_file' => 'custom/modules/Accounts/customRelatedAccountsSubpanel.php',

                    'account_id' => $this->_focus->id,

                    'return_as_array' => true

                ),

    );

    /<>/custom/modules/Accounts/customRelatedAccountsSubpanel.php

    <?php

    function get_related_accounts($params) {

        $args = func_get_args();

        $accountId = $args[0]['account_id'];

        $return_array['select'] = "SELECT c.name";

        $return_array['from'] =   "FROM calls c";

        $return_array['where'] =  "WHERE a.id ='".$accountId."'";

        $return_array['join'] =   "LEFT JOIN calls_cstm cc ON c.id=cc.id_c LEFT JOIN accounts a on a.id=cc.account_id_c";

        $return_array['join_tables'] = ”;

        return $return_array;

    }

    /<>/custom/Extension/modules/Accounts/Ext/Language/en_us.lang.php

    $mod_strings['LBL_RELATEDACCOUNT'] = 'Project Activities';

    But i was unable to get a subpanel

  • Sorry the second link is for sugar 6. You should look at the first one, I've tried it and it worked for me. It looks like you followed the seconj one from the developer blog and it doesnt work in sugar 7.x

  • Try installing this, mot 100% it works.

  • Hi Gustav

        As a start up can you please update me something simple.For example like creating the calls subpanel in Accounts or anything simple.

  • Have you tied the package? Installed it? Does it work? You change the content of getCustomJoin function to get another result.

Reply Children
No Data