3

in SugarCRM some modules like "Calls" has an "i" (Additional Details) icon in List view which shows some additional details about that record.

I want to display same kind for other modules like customer visits with some custom details of the records. Any hints or guidance will be helpful.

AjayR
  • 4,169
  • 4
  • 44
  • 78
  • I can see `i` icon on Listview but not able to find it in Detail View (even in Calls module ). Are you sure its Detail View ?? – SuVeRa Oct 10 '12 at 10:34
  • @ajay, suvera is right you just have to replace {MODULE_NAME} and {MODULE_BEAN_NAME} with your module name and class for example your module name is Customers and bean name is Customer than function name will be `additionalDetailsCustomer` for more idea on this. please see sugarcrm_installation/modules/Calls/metadata/additionalDetails.php – simply-put Oct 14 '12 at 05:19

1 Answers1

4

1) Create a file in your metadata folder {MODULENAME}/metadata/additionalDetails.php. You have to find correct place of your module.

  • custom/modules/MODULENAME/metadata/
  • custom/modulebuilder/packages/PACKAGENAME/modules/MODULENAME/metadata/
  • etc...

2) and create a function something like this. replace {MODULENAME} and {MODULE_BEAN_NAME} with actual module name in all places.

function additionalDetails{MODULE_BEAN_NAME}($fields) {
    static $mod_strings;
    if(empty($mod_strings)) {
        global $current_language;
        $mod_strings = return_module_language($current_language, '{MODULENAME}');
    }

    $overlib_string = '';

    if(!empty($fields['NAME']))
        $overlib_string .= '<b>'. $mod_strings['LBL_NAME'] . '</b> ' . $fields['NAME'] . ' <br>';

    //Add whatever info you want to show up to $overlib_string

    $editLink = "index.php?action=EditView&module={MODULENAME}&record={$fields['ID']}";
    $viewLink = "index.php?action=DetailView&module={MODULENAME}&record={$fields['ID']}";

    return array(
        'fieldToAddTo' => 'NAME',
        'string' => $overlib_string,
        'editLink' => $editLink,
        'viewLink' => $viewLink
    );
}

you have to create $overlib_string with your data (in html). If you need edit and view links on your modal box you have to return them as well. $fields is an associative array that contains db record.

3) The i icon should appear on the module list view.

SuVeRa
  • 2,784
  • 2
  • 20
  • 27