Overriding subpanel Cases panel-top under Accounts module

Hi All,

I want to disable the create button in the panel-top of Cases subpanel Accounts module. I followed the threads here about how to manipulate in a specific module.

SugarCRM7 HOW TO:  Manipulate Subpanel Top Buttons (Actions)

but it doesnt seem to work.

Anyone can help me what to put in

$viewdefs['Accounts']['base']['layout']['subpanels']['components'][]  = array (

   'layout'=>'subpanel',

   'label' => 'LBL_CUSTV_CUSTOMER_VISITS_ACCOUNTS_TITLE', <--what to put here?

   'override_paneltop_view' => 'panel-top-for-cases',

   'context' => array(

      'link' => 'account_cases', //is this correct? its what i saw in the relationship in studio

   )

);  

Thanks in advance.

  • Is there a way to use javascript that Cases subpanel panel-top's create button will be disabled when the main module is in Account? anyone can help me with panel-top.js?

    TIA

    Longki Dela Cruz

  • Hi,

    Path--

    In custom/modules/Accounts/Ext/clients/base/layouts/subpanels/subpanels.ext.php

    $viewdefs['Accounts']['base']['layout']['subpanels']['components'][]  = array (

       'layout'=>'subpanel',

       'label' => 'LBL_CUSTV_CUSTOMER_VISITS_ACCOUNTS_TITLE', <----- your sub panel Module title name

       'override_paneltop_view' => 'panel-top-for-cases',

       'context' => array(

          'link' => 'account_cases', // yes you can see the relation of Your module to sub panel from studio relation.

       )

    );  

    js 

    ==> custom/clients/base/layouts/panel/panel.js

    ({
        extendsFrom: 'PanelLayout',

        _initPanelState: function() {
          this._super('_initPanelState');

          if(this.module=='Contacts') {
            if(!_.isUndefined(this.context.attributes.parentModule)) {
              if(this.context.attributes.parentModule == 'Cases') {
                this.context.set('collapsed', true);
              }
            }
          }
        },

    })