Results 1 to 7 of 7

Thread: Changing Contacts / Name in listview

  1. #1
    DN667 is offline Sugar Community Member
    Join Date
    Jul 2008
    Posts
    36

    Default Changing Contacts / Name in listview

    Hello all,

    In our SugarCRM instance (6.3) we changed the name of contacts a bit by adding a few fields (pre- and postfixes). We want those to show up in the list view as well. In stock SugarCRM, the listview only gives us the title, first name and last name of the contact.

    How can custom fields be added to the listview?

    Best, Raj

  2. #2
    kir
    kir is offline Sugar Community Member
    Join Date
    Nov 2011
    Posts
    68

    Default Re: Changing Contacts / Name in listview

    U can do it in studio.
    U made your changes in detailview and Editview.
    Now you need to do the same in the listview - Just add your fields to listview layout in Contact module (drug and drop them to your layout) as you did it in Detailview.

  3. #3
    DN667 is offline Sugar Community Member
    Join Date
    Jul 2008
    Posts
    36

    Default Re: Changing Contacts / Name in listview

    Quote Originally Posted by kir View Post
    U can do it in studio.
    U made your changes in detailview and Editview.
    Now you need to do the same in the listview - Just add your fields to listview layout in Contact module (drug and drop them to your layout) as you did it in Detailview.
    Hi Kir,

    Thanks for your prompt reply. I'm aware of that option, but it actually what I'm after.

    Let me give you an example...

    Here in the Netherlands, we have names like <firstname> <middlename> <lastname>. As we do searches and sorting based on both the first and last name, we can't add the middle name to any of those, without sacrifing either functionality or correctness.

    Let's presume my name is "Jan de Wit". I can make it all work by adding a middle name field to the edit / detail view (which I have done). However, in the listview, my name is "Jan Wit". That makes sense (from a technical point of view) but is no good to my users.

    So what I need is to change the way the "name" field from the listview is built and add one or more fields to the concatenation.

    I hope this clears up a bit?

    Thanks!

  4. #4
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: Changing Contacts / Name in listview

    Quote Originally Posted by DN667 View Post
    Hi Kir,

    Thanks for your prompt reply. I'm aware of that option, but it actually what I'm after.

    Let me give you an example...

    Here in the Netherlands, we have names like <firstname> <middlename> <lastname>. As we do searches and sorting based on both the first and last name, we can't add the middle name to any of those, without sacrifing either functionality or correctness.

    Let's presume my name is "Jan de Wit". I can make it all work by adding a middle name field to the edit / detail view (which I have done). However, in the listview, my name is "Jan Wit". That makes sense (from a technical point of view) but is no good to my users.

    So what I need is to change the way the "name" field from the listview is built and add one or more fields to the concatenation.

    I hope this clears up a bit?

    Thanks!
    You can use Sugar Logic here, just change the name field to have this calculated value:

    PHP Code:
    concat($first_name," ",$middle_name_c," ",$last_name
    John Mertic
    Sugar Community Manager

  5. #5
    DN667 is offline Sugar Community Member
    Join Date
    Jul 2008
    Posts
    36

    Default Re: Changing Contacts / Name in listview

    Quote Originally Posted by jmertic View Post
    You can use Sugar Logic here, just change the name field to have this calculated value:

    PHP Code:
    concat($first_name," ",$middle_name_c," ",$last_name
    Hello John,

    Thanks, that's more or less the thing I expected to be necessary.

    I did a grep for the "concat" funtion, starting from modules/Contact, but I only find this line:

    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','last_name')) . " name, "
    This line is from a function called "address_popup_create_new_list_query". Seems like the wrong place. However, the function embodies this construction:

    PHP Code:
                    //if this is any action that is not the contact address popup, then go to parent function in sugarbean
                    
    if(isset($_REQUEST['action']) && $_REQUEST['action'] !== 'ContactAddressPopup'){
                            return 
    parent::create_new_list_query($order_by$where$filter$params$show_deleted$join_type$return_array$parentbean$singleSelect);
                    } 
    So my guess'd be I'd have to look at the parent, but there's no mention of the name field being built from the first_name and last_name fields.

    Also, how I understand it, the db_contact function can only be used to concat values from a single table; my custom fields are (naturally) in a custom table, as they were studio-made.

    Being stubborn, I gave it a few shots like:

    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','middle_name_c','last_name')) . " name, "
    and
    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','contacts_cstm.middle_name_c','last_name')) . " name, "
    However, to no result..

    Where would I have to look? I think we're getting somewhere, but still I feel lost

    Best, Raj

  6. #6
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: Changing Contacts / Name in listview

    Quote Originally Posted by DN667 View Post
    Hello John,

    Thanks, that's more or less the thing I expected to be necessary.

    I did a grep for the "concat" funtion, starting from modules/Contact, but I only find this line:

    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','last_name')) . " name, "
    This line is from a function called "address_popup_create_new_list_query". Seems like the wrong place. However, the function embodies this construction:

    PHP Code:
                    //if this is any action that is not the contact address popup, then go to parent function in sugarbean
                    
    if(isset($_REQUEST['action']) && $_REQUEST['action'] !== 'ContactAddressPopup'){
                            return 
    parent::create_new_list_query($order_by$where$filter$params$show_deleted$join_type$return_array$parentbean$singleSelect);
                    } 
    So my guess'd be I'd have to look at the parent, but there's no mention of the name field being built from the first_name and last_name fields.

    Also, how I understand it, the db_contact function can only be used to concat values from a single table; my custom fields are (naturally) in a custom table, as they were studio-made.

    Being stubborn, I gave it a few shots like:

    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','middle_name_c','last_name')) . " name, "
    and
    PHP Code:
    $select_query .= db_concat($this->table_name,array('first_name','contacts_cstm.middle_name_c','last_name')) . " name, "
    However, to no result..

    Where would I have to look? I think we're getting somewhere, but still I feel lost

    Best, Raj
    Which version and flavor of Sugar are you using?
    John Mertic
    Sugar Community Manager

  7. #7
    DN667 is offline Sugar Community Member
    Join Date
    Jul 2008
    Posts
    36

    Default Re: Changing Contacts / Name in listview

    Hello John,

    I'm using 6.3.1.Pro flavor.

    Versie 6.3.1 (Gebouwd 7095)
    Best, Raj

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2012-02-22, 12:47 PM
  2. Replies: 40
    Last Post: 2011-10-06, 02:55 PM
  3. changing default opportunities 'listview' query
    By pepotiger in forum Developer Help
    Replies: 2
    Last Post: 2010-10-04, 06:08 AM
  4. Label not changing on Cases layout listview
    By mmansperger in forum Help
    Replies: 1
    Last Post: 2008-12-01, 09:56 PM
  5. Changing Contacts to Leads?
    By Jo Maltby in forum Help
    Replies: 0
    Last Post: 2006-10-20, 02:43 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
  •