Cannot add columns in custom module subpanel

Hello dear sirs and ladies!

I have a problem with custom module subpanels.

When I create a custom module and add a relationship with another module, I am seeing, as expected, the subpanel of the first module under the related module.

The problem is that I cannot find any way to add the necessary columns on the subpanel. I am always watching the same two columns (name and date modified).

Lets make an example:

If I have a payments module, related with Accounts, I can see a list (‘View Payments’) showing all the payment data in columns: the amounts, the dates, their related accounts, etc.

Though, when I am going to an Account, I am seeing only two columns under the payments subpanel there, (Name and Date modified). And I cannot change it whatever I do.

In Studio, I can edit Layouts, (Edit View-Detail View-List View-Quick Create- SuiteCRM Dashlet - Popup View - Filter) but I am not seeing any way to edit the Subpanel column layout.

Can you help?

GO to studio > Account -> subpanel > Payments (drag and drop required field)

This is something that bothered me for a while, but I found the solution.

You have to edit
custom/modules/<your_module_name>/metadata/subpanels/default.php

There, you have to edit the “list_fields” array and add a subarray with the column you want to see.

To add a “description” column, add the following:

‘description’ => array(
‘vname’ => ‘LBL_DESCRIPTION’,
‘widget_class’ => ‘SubPanelDetailViewLink’,
‘module’ => $module_name,
‘width’ => ‘25%’,
),

save and voila! there is your column!

The significant part is the name of the array, which is the name of the variable of your field (here ‘description’). The ‘vname’ is the column title (you can put there anything you want), the width is the width of the column, "widget_class’ is the type of the control (there’s buttons, links etc, check the other subarrays), and ‘module’ is the name of the module from where you can take the variable .

Sometimes, for various reasons, you may not find the ‘subpanels’ directory in the custom directory. In this case, copy there the same directory from
modules/<your_module_name>/metadata/subpanels/