Subpanel to be Editable Before Create A Record Like Opportunity Revenue Line Items

Is there any way to  Add  Revenue line items For custom Module where we can select revenue line item Before creation of record. How can we do that ?? Help me to solve this....

Has anyone done this?  Are there any examples or posts out there about how to do it?

Alex Nassi hats

  • Hi Ash,

    Yes, we can do that. Have a look into modules/Opportunities/clients/base/layouts/create/create.php and you will notice that an extra layout called "subpanels-create" been added to the components array after create view component. This layout is defined in modules/Opportunities/clients/base/layouts/subpanels-create/subpanels-create.php

    So now, go to your custom module and copy the following code in

    1. custom/modules/<your_custom_module>/clients/base/layouts/create/create.php

    <?php

    //custom create layout with RLI create layout
    $viewdefs['<custom_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',
                                'css_class' => 'main-pane span8',
                                'components' => array(
                                    array(
                                        'view' => 'create',
                                    ),
                                    array(
                                        'layout' => 'subpanels-create',
                                    ),
                                ),
                            ),
                        ),
                        array(
                            'layout' => array(
                                'type' => 'base',
                                'name' => 'preview-pane',
                                'components' => array(
                                    array(
                                        'layout' => 'create-preview',
                                    ),
                                ),
                            ),
                        ),
                    ),
                    'last_state' => array(
                        'id' => 'create-default',
                    ),
                ),
            ),
        ),
    );

    where <custom_module_name> is your custom module name you see in the URL while accessing your custom module.

    2. copy following code to custom/modules/<your_custom_module>/clients/base/layouts/subpanels-create/subpanels-create.php

    <?php

    //layout for RLI create
    $viewdefs['<custom_module_name>']['base']['layout']['subpanels-create'] = array(
        'type' => 'subpanels',
        'components' => array(
            array(
                'layout' => 'subpanel-create',
                'label' => 'LBL_RLI_SUBPANEL_TITLE',
                'override_subpanel_list_view' => 'subpanel-for-opportunities-create',
                'context' => array(
                    'link' => '<link_name_with_RLI>',
                ),
            )
        ),
    );

    where <link_name_with_RLI> is the link name for revenue line items module from your custom module.

    Define the label "LBL_RLI_SUBPANEL_TITLE" in custom/Extension/modules/<your_custom_module>/Ext/Language/en_us.lang.php file

    Try quick repair and rebuild and see if you can see the RLI create subpanel during record create in your custom module.

    Let us know if this helps.

    Regards.

    Hats

  • Hai hats ,

    You're Awesome Man It worked.. You Saved My Time..

  • hats

    Is This Procedure Work For Custom Modules And Quoted Line Items ??

    I have tried with custom module and quoted line items. it is not working attaching an image for Reference..

    Fields not showing to Enter Values..

    Help me on this..

  • Hi Ash,

    Have you created the view defined under subpanels-create layout similarly the one which exists in RLI.

    Please share what you have done so far and we can look into it further.

    Regards.

    Hats

  • Thanks For Reply hats

    Sharing you the content look into it , and let me know what i am done wrong..

    1.custom/modules/<custom_module>/clients/base/layouts/create/create.php

    <?php
    //custom create layout with SoProducts create layout
    $viewdefs['gmsa1_SalesOrder']['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',
                                    ),
                                    array(
                                        'layout' => 'subpanels-create',
                                    ),
                                ),
                            ),
                        ),
                        array(
                            'layout' => array(
                                'type' => 'base',
                                'name' => 'preview-pane',
                                'components' => array(
                                    array(
                                        'layout' => 'create-preview',
                                    ),
                                ),
                            ),
                        ),
                    ),
                    'last_state' => array(
                        'id' => 'create-default',
                    ),
                ),
            ),
        ),
    );

    2. Custom/modules/<custom_module>/clients/base/layouts/subpanels-create/subpanels-create.php

    <?php

    //layout for SoProducts create
    $viewdefs['gmsa1_SalesOrder']['base']['layout']['subpanels-create'] = array(
    'type' => 'subpanels',
    'components' => array(
    array(
    'layout' => 'subpanel-create',
    'label' => 'LBL_GMSA1_SALESORDER_SOI_SOPRODUCTS_1_FROM_GMSA1_SALESORDER_TITLE',
    'override_subpanel_list_view' => 'subpanel-for-gmsa1_SalesOrder-create',
    'context' => array(
    'link' => 'gmsa1_salesorder_soi_soproducts_1',
    ),
    )
    ),

    );

  • Hi Ash,

    Please try to create js controller file for your subpanel-create view (subpanel-for-gmsa1_SalesOrder-create) and extends it from 'SubpanelListCreateView' view just like in RLI module for subpanel-for-opportunities-create view.

    Please let us know if this helps.

    Regards.

  • Thanks For Reply hats

    Created .Js Controller File for subpanel -create view still fields are not visible