Customize items shown when clicking 'Select' button inside a subpanel


Go to a subpanel > Click ‘Select’ > a popup winow comes up with results

^ I want to customze the above results that come up, what is the most elegant solution in this case?

Currently I’m checking if there is something inside SugarWidgetSubPanelTopButton which can be customized (this is the ‘Select’ button’s class)

I don’t know how to achieve what you want but here is a sample on how to dynamically remove subpanels. I hope it gives you some light on what you want to accomplish:

Good luck,



Thank you for the reply. I’m trying to do something a bit different. I want to control what results are pulled from the db when we click “Select” inside the subpanel.

Found the solution:

We need to override the top select button class like so

1 =>
array (
'widget_class' => 'SubPanelTopSelectButtonParentProjectLeads',
'mode' => 'MultiSelect',

Then inside that custom class we would specify our custom filter by changing the value of $initial_filter

So we would replace $initial_filter = ”;

Here’s sample code if we want to display only records that have parent_project_id_c field value of “83b30b20-83a6-8099-b3b9-5d4a491888e6”. Note that you may have to add _advanced to the field name in order for it to work:


Source and additional info:

1 Like


to implement a filter for the subpanel select button there is no need to override the
SubPanelTopSelectButton class.

You can edit the layoutdefs found in
and add initial filters in here:

    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
      'initial_filter_fields' => array ('field_name_in_vardef' => 'field_name_in_popup'),

To find out the “field_name_in_vardef”, add your field to the detailview and then checkout the name of it in ‘name’ in the file:

To find out the “field_name_in_popup”, first add this field to your Popup view, then show this popup view by clicking “Select” on the subpanel on which you want to enforce the filter, then use your browser’s Developer Tools “inspect” function to find out the “name” of the field for which you want to set your filter.

Afterwards, do a Admin → Repair → Quick Repair and Rebuild

1 Like