Subpanel in custom module

Hi

Is it possible to create a subpanel in a custom module where you can select 3 different options with a button? That is to say, can certain related records be filtered in the subpanel and assigned a value? Anyone tried that?

In the image that I am sending, I want the button at the end to be a dropdown with three options.

Thank!!

Hi @fcsd,
Yes it should possible to create a subpanel in a custom module with a dropdown containing three options. Here are the steps I would try:

  1. Create a custom dropdown field in the related module with the three options you want to select.
  2. In the custom module’s vardefs, define the relationship to the related module and add a subpanel definition for the related module.
  3. In the subpanel definition, add a custom view that includes the dropdown field and any other fields you want to display.
  4. Customize the subpanel’s list view to filter the related records based on the selected option in the dropdown field.

Here’s an example of what the subpanel definition might look like in the custom module’s vardefs:

'contacts' => array(
    'name' => 'contacts',
    'type' => 'link',
    'relationship' => 'custom_module_contacts',
    'module' => 'Contacts',
    'bean_name' => 'Contact',
    'source' => 'non-db',
    'vname' => 'LBL_CONTACTS_SUBPANEL_TITLE',
    'id_name' => 'custom_module_contacts_id',
    'link-type' => 'subpanel',
    'tablist' => 'false',
    'subpanel_name' => 'default',
    'subpanel_layout' => array(
        'top_buttons' => array(
            array('widget_class' => 'SubPanelTopButtonQuickCreate'),
            array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'custom_module', 'mode' => 'MultiSelect', 'module' => 'Contacts', 'dropdown_field' => 'custom_dropdown_field'),
        ),
        'components' => array(
            array(
                'view' => 'subpanel-for-custom-module',
                'layout' => array(
                    'components' => array(
                        array(
                            'view' => 'subpanel-list',
                            'label' => 'LBL_CONTACTS_SUBPANEL_TITLE',
                            'module' => 'Contacts',
                            'panel_type' => 'default',
                            'filter_select' => array(
                                'dropdown_field' => 'custom_dropdown_field',
                                'options' => array(
                                    'Option 1' => 'custom_filter_1',
                                    'Option 2' => 'custom_filter_2',
                                    'Option 3' => 'custom_filter_3',
                                ),
                            ),
                            'link_type' => 'related',
                            'columns' => array(
                                array('name' => 'full_name'),
                                array('name' => 'phone_work'),
                                array('name' => 'custom_dropdown_field'),
                            ),
                        ),
                    ),
                ),
            ),
        ),
    ),
),

This is just an example and you will need to adjust it to fit your specific needs.

Ey! That sounds like ChatGPT haha .

Thanks anyway. I’m already trying how I found an answer right here in the forum so if it’s useful I’ll leave the solution

Does this answer work, though

I’m actually trying to do this today. @fcsd if you have any info I’d love it!

My initial thought is to copy over the functionality from the Activities History and modify it to work with the subpanel of another module.

(I think that’s what they’re doing in the Version 8 release).

I’ll post my progress if I can get it to work.

Hello!

Well, I was able to successfully create a subpanel that retrieves information from another module through a SQL query, but I couldn’t manage to enable editing or deleting those records. It can only display them in the subpanel.