Sugar 7 Contact module record view header add middle name

Hello,

I want to add middle name record view header pane in contact module.

Ramana Raju Santhana Francesca Shiekh Alan Apter

Thanks

Dipesh

Offshore Evolution Pvt Ltd

Parents
  • I believe you will need to customize both the fullname feld type:

    clients/base/fields/fullname

     

    and the Contacts record view php

                    array(
                        'name' => 'full_name',
                        'label' => 'LBL_NAME',
                        'dismiss_label' => true,
                        'type' => 'fullname',
                        'fields' => array('salutation', 'first_name', 'last_name'),
                    ),

    HTH

    Francescas

  •   Hi Francesca Shiekh & Ajay Kumar

    It is work for me in Record edit view. When I save middle name, it is saved with database. But I have load record view page at that time middle name is undefined display.

    List page

    Record view page

    Thanks

    Offshore Evolution Pvt Ltd

  • Adding the middle name to the view metadata is not enough, you have to retrieve the middle name when you retrieve the field "Full Name" which is really a composition of fields.

    You need to add the middle name to your customized fullname field type. Look at:
    <your_sugar_root>/jssource/src_files/clients/base/fields/fullname/fullname.js

    to see if you can understand how full name is composed.

     

    I've not played with it but for one thing you can see that there is a format map:

        formatMap: {

            'f': 'first_name',

            'l': 'last_name',

            's': 'salutation'

        },

    that does not currently include the middle name (which I believe is a custom field).

     

    You can copy that fullname.js to custom/clients/base/fields/fullname/fullname.js (create any part of the directory that doesn't already exist) and "play" with it. It looks like it may be enough to add middle name to the format map, perhaps something like:

     

        formatMap: {

            'f': 'first_name',

            'l': 'last_name',

            's': 'salutation',

            'm':'middle_name_c' <--- make sure this matches your field name

        },

     

     

    You can see the initialize function gets the field definition from the formatMap.

    I have not tried this myself so just "play" with it a bit and see what you can deduce from the original fullname.js

     

    HTH

    FrancescaS

Reply
  • Adding the middle name to the view metadata is not enough, you have to retrieve the middle name when you retrieve the field "Full Name" which is really a composition of fields.

    You need to add the middle name to your customized fullname field type. Look at:
    <your_sugar_root>/jssource/src_files/clients/base/fields/fullname/fullname.js

    to see if you can understand how full name is composed.

     

    I've not played with it but for one thing you can see that there is a format map:

        formatMap: {

            'f': 'first_name',

            'l': 'last_name',

            's': 'salutation'

        },

    that does not currently include the middle name (which I believe is a custom field).

     

    You can copy that fullname.js to custom/clients/base/fields/fullname/fullname.js (create any part of the directory that doesn't already exist) and "play" with it. It looks like it may be enough to add middle name to the format map, perhaps something like:

     

        formatMap: {

            'f': 'first_name',

            'l': 'last_name',

            's': 'salutation',

            'm':'middle_name_c' <--- make sure this matches your field name

        },

     

     

    You can see the initialize function gets the field definition from the formatMap.

    I have not tried this myself so just "play" with it a bit and see what you can deduce from the original fullname.js

     

    HTH

    FrancescaS

Children