subpanel displaying error when subpanel has items

I have problems with a custom subpanel which should show records of one-many self relation, similar to accounts->members.

  • the Detailview with subpanel is displayed when the subpanel query has no data
  • the Detailview is not displayed when the subpanel query has data: “There was an error processing your request, please try again at a later time.”

After deactivating ajax for the custom module:

  • the Detailview with the subpanel is displayed when there is no subpanel data
  • the Detailview doesn’t show the subpanel when subpanel data is available.

The subpanel query shows the correct records when i use the logged query in mysql.
The module is defined in modules/CS_Projects, the related field works in editview.
The alternate subpanel definition is defined in modules/CS_Projects/metadata/subpanels/sp_subprojects.php

Configuration: SuiteCRM 7.11.6, PHP 7.2, Ubuntu 18.04. LTS

Subpaneldef in custom/Extension/modules/CS_Projects/Ext/Layoutdefs/layoutdefs.ext.php

$layout_defs["CS_Projects"]["subpanel_setup"]['sp_subprojects'] = array (
  'order' => 80,
  'module' => CS_Projects',
  'subpanel_name' => 'sp_subprojects',
  'sort_order' => 'asc',
  'sort_by' => 'name',
  'title_key' => 'LBL_CS_PROJECT_SUBPROJECTS_TITLE',
  'get_subpanel_data' => 'vf_subprojects',
  'top_buttons' => array(),
);

Vardefs in custom/Extension/modules/CS_Projects/Ext/Vardefs/vardefs.ext.php

$dictionary["CS_Projects"]["fields"]["vf_subprojects"] = array (
  'name' => 'vf_subprojects',
  'type' => 'link',
  'relationship' => 'vr_project_subprojects',
  'source' => 'non-db',
  'module' => 'CS_Projects',
  'bean_name' => 'cs_project_id',
  'side' => 'left',
  'vname' => 'LBL_PROJECT_SUBPROJECTS_TITLE',
);
$dictionary["CS_Projects"]["relationships"]["vr_project_subprojects"] = array(
    'lhs_module'=> 'CS_Projects',
    'lhs_table'=> 'cs_projects',
    'lhs_key' => 'id',
    'rhs_module'=> 'CS_Projects',
    'rhs_table'=> 'cs_projects',
    'rhs_key' => 'cs_project_id',
    'relationship_type'=>'one-to-many',
);

I have no idea what’s wrong with this subpanel.
Rolf

Hi @Rolf-SCRM

Every time a subpanel is displayed SuiteCRM performs a request like this one:

index.php?sugar_body_only=1&module=MODULE&subpanel=SUBPANELNAME&action=SubPanelViewer&inline=1&record=RECORD&layout_def_key=LAYOUT_DEF_KEY&inline=1&ajaxSubpanel=true

Can you capture this URL (using F12 in your browser), open a new tab, perform that request and paste what SuiteCRM is loggin while resolving that request?

Please, set the log level in debug:

$sugar_config['logger']['level'] = 'debug';

Regards

Thanks for your answer.
The problem is gone after some quick repairs - do not ask me what happend, i dont’ know.

kind regards.