Custom Code to change record headers

I was advised to ask for a custom code to change the header array in our Employee module, which was copied from the contacts module.

original query: We want to add a field to a record header (ex. in Contacts, the header at the top that shows the Module Icon, Salutation, First Name, Last Name). We would like the header array to be First Name, Middle Initial, Last Name.

Can anyone help?

  • For more context, here is the original post:

    I know the panel_header array in record.php can be edited, but I wasn't sure how to make it look pretty or how Renee might add a field between first and last name.

    , I was hoping you might have more insight to share.

    Patrick McQueen
    Director, SugarCRM Support

  • Hi All,

    I don't see an issue with extending record.php as long as you use our extension framework.

    The trick here is that we have the field type fullname that makes it look pretty and has the view/edit onClick effect, and it is not very "customizable" as it relies on pre-defined naming formats.

    My suggestion is to copy the field type fullname from clients/base/fields/fullname to custom/clients/base/fields/header_fullname

    Remove the formatMap complexity from it (it uses a pre-defined format in our Person module) you don't need that for now.

    Extend Contacts and modify module in the 'custom/modules/Contacts/clients/base/views/record/record.php' and add your new field there pointing to your new header_fullname as the field, something like:

     * Your installation or use of this SugarCRM file is subject to the applicable
     * terms available at
     * If you do not agree to all of the applicable terms or do not have the
     * authority to bind the entity as an authorized representative, then do not
     * install or use this SugarCRM file.
     * Copyright (C) SugarCRM Inc. All rights reserved.
    $viewdefs['Contacts']['base']['view']['record']['panels'][0]['fields'] = array(
        'name' => 'panel_header',
        'header' => true,
        'fields' => array(
                'name' => 'picture',
                'type' => 'hint-contacts-photo',
                'size' => 'large',
                'dismiss_label' => true,
                'white_list' => true,
                'related_fields' => array('hint_contact_pic'),
                'name' => 'name',
                'label' => 'LBL_NAME',
                'dismiss_label' => true,
                'type' => 'header_fullname',
                'fields' => array('first_name', 'middle_name_custom', 'last_name'),
                'name' => 'favorite',
                'label' => 'LBL_FAVORITE',
                'type' => 'favorite',
                'dismiss_label' => true,
                'name' => 'follow',
                'label'=> 'LBL_FOLLOW',
                'type' => 'follow',
                'readonly' => true,
                'dismiss_label' => true,

    I haven't tested it, but it should do the trick for you.. 

    SugarCRM | Principal Developer Advocate