Search code examples
sugarcrmsuitecrm

How to add custom action button in suiteCRM module sub panel list?


I need some suggestion in my suite CRM module integration. I have a sub-panel in one of my modules and required to add one more edit button to redirect to a custom form to take some input from the user for each row separately.

Below is a sample image of my sub-panel list view.

In this image on click of the edit button of a row there is a remove button, I want to add one more custom button after remove and need to redirect from there to my new form

In the above image on click of the edit button of a row, there is a remove button, I want to add one more custom button after remove and need to redirect from there to my new form.

I have checked some of forums and blogs but didn't found the solution.


Solution

  • To add a button you will need to modify the metadata of that sub-panel. In metadata, you will see the following code for the Edit and Remove buttons:

     'edit_button' => 
      array (
        'vname' => 'LBL_EDIT_BUTTON',
        'widget_class' => 'SubPanelEditButton',
        'module' => 'Contacts',
        'width' => '5%',
        'default' => true,
      ),
      'remove_button' => 
      array (
        'vname' => 'LBL_REMOVE',
        'widget_class' => 'SubPanelRemoveButton',
        'module' => 'Contacts',
        'width' => '5%',
        'default' => true,
      ),
    

    You can add your new button using same array syntax. As you can see that every button use specific widget class(defined as widget_class) therefore you will need to add new widget_class class for that. You can find existing widget classes in this folder: include/generic/SugarWidgets.

    Cheers!