how to add SubPanel on create view??

I have created one custom Module. I want to add SubPanel on record Create View of that Module.(like Opportunity module contains Revenue Line Item in its Record Create View) please help me..

  • Hi Tejas Kulkarni,

    You can add related module subpanel on create view in 2 easy steps.

    Step1: Override the parent module create layout metadata file and add subpanels-create layout to the main-pane components array.

    custom/modules/<your_module_name>/clients/base/layouts/create/create.php

    $viewdefs['<your_module_name>']['base']['layout']['create'] = array(
        'components' => array(
            array(
                'layout' => array(
                    'type' => 'default',
                    'name' => 'sidebar',
                    'components' => array(
                        array(
                            'layout' => array(
                                'type' => 'base',
                                'name' => 'main-pane',
                                'components' => array(
                                    array(
                                        'view' => 'create',
                                    ),
                                    //add subpanels-create layout after create view
                                    array(
                                        'layout' => 'subpanels-create',
                                    ),
                                ),
                            ),
                        ),
                        array(
                            'layout' => array(
                                'type' => 'base',
                                'name' => 'preview-pane',
                                'components' => array(
                                    array(
                                        'layout' => 'preview',
                                    ),
                                ),
                            ),
                        ),
                    ),
                    'last_state' => array(
                        'id' => 'create-default',
                    ),
                ),
            ),
        ),
    );

    Step2: Create new subpanels-create layout in your parent module.

    custom/modules/<your_module_name>/clients/base/layout/subpanels-create/subpanels-create.php

    $viewdefs['<your_module_name>']['base']['layout']['subpanels-create'] = array(
      'type' => 'subpanels',
      'components' => array(
        array(
          'layout' => 'subpanel-create',
          'label' => 'LBL_CUSTOM_MODULE_SUBPANEL_TITLE',
          'context' => array(
            'link' => '<link_name_for_related_module>',
          ),
        )
      ),
    );

    Let us know if this helps.

    Regards.

  • Hi Hatim or anyone else, 

    I tried to implement this functionality for the cases module to add the creation of other related module to it. The subpanel is rendered, the columns are visible but there is no model created. In other words, the subpanel is empty? Any thoughts? 

  • Perhaps you need to define the attribute 'override_subpanel_list_view' on subpanels-create layout.

    Also double check if there are some error message in the console tab of Browser's developer tools.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André how are you ? I am in the same situation. Where should I define the atrribute 'override_subpanel_list_view'? Could you please give some example? 

    Thank you so much. Best Regards.
    Leandro.