Results 1 to 10 of 10

Thread: How do I display values coming from 2 fields (similar to "Name")

  1. #1
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default How do I display values coming from 2 fields (similar to "Name")

    Hello!

    I noticed that in the Detail View of the Contacts module, SugarCRM combines the Last and First Name fields.

    How do I do this for other fields?

    Currently, I added fields for Japanese Last and First Name which are displayed separately in the Detail View. I want to be able to do the same thing as the default view, except it should display "Last Name First Name".

    Thanks!

  2. #2
    crmbalah is offline A Prolific Poster
    Join Date
    Mar 2009
    Location
    chennai
    Posts
    418

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hi
    try to write 'customCode' in detailviewdefs.php.

  3. #3
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Quote Originally Posted by Pepin View Post
    Hello!

    I noticed that in the Detail View of the Contacts module, SugarCRM combines the Last and First Name fields.

    How do I do this for other fields?

    Currently, I added fields for Japanese Last and First Name which are displayed separately in the Detail View. I want to be able to do the same thing as the default view, except it should display "Last Name First Name".

    Thanks!
    Hi Pepin

    Have a look at the cache/modules/Contacts/ContactVardefs.php

    PHP Code:
        'name' => 
        array (
          
    'name' => 'name',
          
    'rname' => 'name',
          
    'vname' => 'LBL_NAME',
          
    'type' => 'name',
          
    'fields' => 
          array (
            
    => 'first_name',
            
    => 'last_name',
          ),
          
    'sort_on' => 'last_name',
          
    'source' => 'non-db',
          
    'group' => 'last_name',
          
    'len' => '255',
          
    'db_concat_fields' => 
          array (
            
    => 'first_name',
            
    => 'last_name',
          ),
          
    'importable' => 'false',
        ), 

    You can write some extended vardefs to do the same for your fields.
    Remember rebuilding extensions just after generating the extended vardefs.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  4. #4
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hi guys!

    Thanks for the info!

  5. #5
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hi Andre!

    We tried the above codes. When we tried rebuilding the extensions, the file gets overwritten and reverted back to the original.

    Are we correct in using the "rebuild" found in the Repair of the Admin section? Or are we supposed to edit a different file?

    Sorry, we're really quite new to these.

    Thanks for the help.

  6. #6
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Let us know both file name and content you had created/modified.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  7. #7
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hello!

    We've created the following fields in Contacts.
    a. Japanese First Name - jp_first_name_c
    b. Japanese Last Name - jp_last_name_c
    c. Japanese Name - the plan is to show this as a combination of "jp_first_name_c + jp_last_name_c"

    We've copied the portion found in the ContactVardefs.php and came up with the following:

    'japanese_name_c' =>
    array (
    'name' => 'japanese_name_c',
    'rname' => 'japanese_name_c',
    'vname' => 'LBL_JAPANESE_NAME',
    'type' => 'name',
    'fields' =>
    array (
    0 => 'jp_first_name_c',
    1 => 'jp_last_name_c',
    ),
    'sort_on' => 'jp_last_name_c',
    'source' => 'non-db',
    'group' => 'jp_last_name_c',
    'len' => '255',
    'db_concat_fields' =>
    array (
    0 => 'jp_first_name_c',
    1 => 'jp_last_name_c',
    ),
    'importable' => 'false',
    ),


    Now, we're confused as to where we should place this set of codes. We tried updating the same file. But after rebuilding, the codes get returned to the original.

    Thanks for all your help.

  8. #8
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hi Pepin

    My suggestion is to create an extended vardefs for this purpose.
    You need to create the folders and file custom/Extension/modules/Contacts/Ext/Vardefs/vardefs.ext.php

    The content should looks like that:
    PHP Code:
    $dictionary['Contact']['fields']['japanese_name'] = array(
          
    'name' => 'japanese_name',
          
    'rname' => 'japanese_name',
          
    'vname' => 'LBL_JAPANESE_NAME',
          
    'type' => 'name',
          
    'fields' => 
          array (
            
    => 'jp_first_name_c'',
            1 => '
    jp_last_name_c'',
          ),
          
    'sort_on' => 'last_name',
          
    'source' => 'non-db',
          
    'group' => 'last_name',
          
    'len' => '255',
          
    'db_concat_fields' => 
          array (
            
    => 'jp_first_name_c'',
            1 => '
    jp_last_name_c'',
          ),
          
    'importable' => 'false',
    ); 
    Go to Admin -> Repair -> Rebuild Extensions

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  9. #9
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Thanks so much!

    I'll update again after we try this out.

  10. #10
    Pepin is offline Member
    Join Date
    May 2009
    Posts
    14

    Default Re: How do I display values coming from 2 fields (similar to "Name")

    Hi Andre!

    We were able to proceed with the rebuilding.

    After rebuilding, we noticed that the japanese_name_c field that we originally created disappeared. Is this normal.

    Our problem now is how to add the janapese_name_c field into the layouts.

    Thanks in advance!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save Display values instead of "keys" for a dropdown?
    By evangelis in forum Developer Help
    Replies: 4
    Last Post: 2009-05-03, 08:19 AM
  2. Replies: 4
    Last Post: 2008-08-23, 02:20 AM
  3. Where is the "Industry" field coming from?
    By mmansperger in forum Help
    Replies: 6
    Last Post: 2008-04-11, 04:46 PM
  4. Custom field similar to "Account Name"
    By adamedoe in forum Help
    Replies: 1
    Last Post: 2007-05-26, 06:11 PM
  5. Replies: 2
    Last Post: 2006-12-15, 03:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •