I have also tried achieving this by using this: http://urdhva-tech.com/blogs/add-custom-subpanel-in-accounts-module
My files look like this:
/var/www/html/custom/Extension/modules/Cases/Ext/Layoutdefs/RelatedCases.php
<?php
$layout_defs['Cases']['subpanel_setup']['related_cases'] =
array('order' => 49,
'module' => 'Cases',
'subpanel_name' => 'ForCases',
'get_subpanel_data' => 'function:get_related_cases',
'generate_select' => true,
'title_key' => 'LBL_RELATED_CASES',
'top_buttons' => array(),
'function_parameters' => array(
'import_function_file' => 'custom/modules/Cases/customRelatedSubpanel.php',
'Case_Name' => $this->_focus->name,
'return_as_array' => 'true'
),
);
/var/www/html/custom/modules/Cases/customRelatedSubpanel.php
<?php
function get_related_cases($params) {
$args = func_get_args();
$opportunitiesSalesStage = $args[0]['sales_stage'];
$CaseName = $args[0]['Case_Name'];
$return_array['select'] = " SELECT cases.*";
$return_array['from'] = " FROM cases ";
$return_array['where'] = " WHERE cases.deleted = '0' AND cases.name = '" . $CaseName . "'";
$return_array['join'] = '';
$return_array['join_tables'] = '';
return $return_array;
}
The cases record opens, but when trying to open the new sub panel, I get gif representing it is thinking and this error message on the apache log
[Thu Oct 04 15:18:17.880725 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Notice: Trying to get property of non-object in /var/www/html/include/SubPanel/SubPanel.php on line 387, referer: http://172.16.1.141/index.php?action=ajaxui
[Thu Oct 04 15:18:17.884436 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Notice: Trying to get property of non-object in /var/www/html/include/SubPanel/SubPanel.php on line 172, referer: http://172.16.1.141/index.php?action=ajaxui
[Thu Oct 04 15:18:17.884616 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Notice: Trying to get property of non-object in /var/www/html/include/SubPanel/SubPanel.php on line 437, referer: http://172.16.1.141/index.php?action=ajaxui
[Thu Oct 04 15:18:17.884689 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Notice: Trying to get property of non-object in /var/www/html/include/SubPanel/SubPanel.php on line 423, referer: http://172.16.1.141/index.php?action=ajaxui
[Thu Oct 04 15:18:17.884743 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Notice: Trying to get property of non-object in /var/www/html/include/ListView/ListViewSubPanel.php on line 135, referer: http://172.16.1.141/index.php?action=ajaxui
[Thu Oct 04 15:18:17.885016 2018] [:error] [pid 1282] [client 172.16.1.9:20825] PHP Fatal error: Uncaught Error: Call to a member function isCollection() on boolean in /var/www/html/data/SugarBean.php:968\nStack trace:\n
#0 /var/www/html/include/ListView/ListView.php(1132): SugarBean::get_union_related_list(Object(aCase), 'id', 'asc', '', '', -1, 10, '', false)\n
#1 /var/www/html/include/ListView/ListViewSubPanel.php(142): ListView->processUnionBeans(Object(aCase), false, '_CELL')\n
#2 /var/www/html/include/SubPanel/SubPanel.php(220): ListViewSubPanel->process_dynamic_listview('Cases', Object(aCase), false)\n
#3 /var/www/html/include/SubPanel/SubPanel.php(231): SubPanel->ProcessSubPanelListView('include/SubPane...', Array)\n
#4 /var/www/html/include/SubPanel/SubPanelViewer.php(95): SubPanel->display()\n
#5 /var/www/html/include/MVC/Controller/SugarController.php(1087): require_once('/var/www/html/i...')\n
#6 /var/www/html/include/MVC/Controller/SugarController.php(468): SugarController->handleActionMaps()\n
#7 /var/www/html/include/MVC/Controller/SugarController.php(373): SugarController->process()\n
#8 /var/www/html/inclu in /var/www/html/data/SugarBean.php on line 968, referer: http://172.16.1.141/index.php?action=ajaxui
If anyone could help on either of these methods or point me in another direction Any help would be greatly appreciated .