0 Comments | 0 Shares | Urdhva Tech | Tags: SubPanel SugarCRM DetailView

Sometimes Scrolling DetailView is annoying if many subpanel has no records into it.

We come across interesting requirement in which we have to remove all those subpanel which has no records, so user are easily check the related records without much scrolling.

We achieve the functionality as follows.

For Example, We have to do changes for Accounts module.

(1) Create / Edit custom/modules/Accounts/views/view.detail.php

Add the following code into it.


function _displaySubPanels(){
global $db;
require_once ('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($this->bean, $this->module);

$subpanelLists = $subpanel->subpanel_definitions->layout_defs['subpanel_setup'];
foreach($subpanelLists as $subpanelModuleName => $subpanelModuleDefinations)
     $notConsiderSubpanel = array('activities','history');
     if(!in_array($subpanelModuleName,$notConsiderSubpanel) && array_key_exists("get_subpanel_data", $subpanelModuleDefinations) && !empty($subpanelModuleDefinations['get_subpanel_data']))
          $loadRelationshipName = $subpanelModuleDefinations['get_subpanel_data'];
          $pos = strpos($loadRelationshipName, "function:");
          if ($pos === false)

echo $subpanel->display();

(2) Refresh the Account's DetailView and see the effects.



Download attachments:
  • No Comments Found.
Post your comment