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

  • HiFrancesca Shiekh ,

    custom/modules/Contacts/clients/base/fields/fullname/fullname.js

    /*
    * I only wanted to apply this change to the Contacts modules so I put this file in:
    * custom/modules/Contacts/clients/base/fields/fullname/
    */
    ({
    extendsFrom: 'FullnameField',

    formatMap: {
    'f': 'first_name',
    'l': 'last_name',
    's': 'salutation',
    'm': 'middle_name_c'
    },

    initialize: function(options) {
    // override the name format for this module
    app.user.setPreference('default_locale_name_format', 's f m l');

    this._super('initialize', [options]);
    },

    format: function() {
    var fullname = this.model.attributes.salutation +' '+ this.model.attributes.first_name +' ';
    fullname += this.model.attributes.middle_name_c +' '+ this.model.attributes.last_name;

    return fullname;
    },
    })

    It display with middle name. 

    When I will save record, It will store with Database.

    Thanks

    Offshore Evolution Pvt Ltd

  • Hi Bao Tran Hoang,

    Can you customize record-edit.hbs.

    clients/base/fields/fullname/record-edit.hbs

    {{#each fields}}
        <span class="record-cell{{#if span}} span{{span}}{{/if}}" data-name="{{name}}" data-type="{{type}}">
            {{#unless dismiss_label}}
                <div class="record-label" data-name="{{name}}">{{str label ../../../module}}</div>
            {{/unless}}
            <span data-fieldname="{{name}}" style="width:30%">
                {{placeholder}}
            </span>
        </span>
    {{/each}}
  • Hi Bao Tran Hoang,

    Create new file below path and try it.

    custom/modules/Contacts/clients/base/fields/fullname/record-edit.hbs

    {{!--
    /*
    * Your installation or use of this SugarCRM file is subject to the applicable
    * terms available at
    * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
    * 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.
    */
    --}}
    {{#each fields}}
    <span class="record-cell{{#if span}} span{{span}}{{/if}}" data-name="{{name}}" data-type="{{type}}" style="width:25%">
    {{#unless dismiss_label}}
    <div class="record-label" data-name="{{name}}">{{str label ../../../module}}</div>
    {{/unless}}
    <span data-fieldname="{{name}}">
    {{placeholder}}
    </span>
    </span>
    {{/each}}

  • Hi Offshore Evolution,

    Thank you very much, It worked with last name size but when I create contact and save it is undefined for middle name, I updated fullname.js already

  • Hi Bao Tran Hoang,

    create file custom/themes/custom.less

    then add lines:

    .record-cell[data-name="mi_c"]{ //name of your custom middle_name field
       width: 10em !important;
    }

  • Thank for your reply Roland Cadavos,

    It does not work with me, 

    My code:

    .record-cell[data-name="middle_name_c"]{ 
       width: 10em !important;
    }

    .record-cell[data-name="suffix_c"]{
       width: 10em !important;
    }

  • I added Middle Name in Listview, the Fullname display is Ok

  • Hi Bao Tran Hoang,

    Please can you explain me, how it's come full name ?

  • Hi Offshore Evolution

    You add middle_name_c in Available column of Listview in studio

  • Also check your config, I just noticed that there is a 

    'default_locale_name_format' => 's f l' //salutation first last

  • Yes it is working with list view page.

    How does it work with record view and edit record view ?

Reply Children
No Data