Results 1 to 7 of 7

Thread: contact to multiple accounts

  1. #1
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Arrow contact to multiple accounts

    Hi folks,

    Contacts <-> Accounts is many-to-many. But by default when creating new contact I can assing only one account. In modules/Contacts/meta/subpaneldefs.php I've added 'accounts' array in subpanel_setup array. And now I have a pretty subpanel for adding more that one account. Sounds good. But when add second account to contact, in listview in Contacts there are two entries with the same contact name. One for Account1 and another for Account2. Is this normal? I want to list only one contact name and when click on it in the Accounts subpanel to display the other accounts.

    SugarCE 5.1.0b (Build 4905)

  2. #2
    sugarcane is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,207

    Default Re: contact to multiple accounts

    Hello zaska,

    this is the normal Sugar behavior (even before you made changes). If a Contact is attached to more than one Account, then it will appear more than once in the Contact list view, listed each time with the different Account Name. It is really the same contact record -- so if you have a contact whose primary account is Company A (this is the account field on the contact record) , even if you see a contact in the list view with Company A and Company B, when you click on the contact record listed with Company B, it will still show company A as the account field in the contact record.
    Intelestream has a great deal of experience hosting and customizing the SugarCRM application. Our company is made up by former employees of SugarCRM, and together we have over 50 years of experience working with the application. To learn more about us, please visit our website at www.intelestream.net or contact us directly at 800-391-4055 or by email at info@intelestream.net

  3. #3
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: contact to multiple accounts

    Hi sugarcane,

    Yes, this is true. It's the same contact id. And kind of logical Sugar to have such behavior.
    Do anyone know how to change this or it's too deep in the code?

  4. #4
    tjeerd is offline Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Default Re: contact to multiple accounts

    When this is 'normal Sugar behaviour', I consider it as a bug. The Contacts <-> Accounts relationship is many-to-many. I do not see accounts repeated for every contact, why do I see contacts repeated for each of the accounts?

    If I am able to change the layout templates so that I can consider it as a real many-to-many relationship (like projects or opportunities), can I also change the metadata in such a way that the account information is left out the list view (and underlying query)?

    Can anyone help here?

  5. #5
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: contact to multiple accounts

    Quote Originally Posted by tjeerd View Post
    When this is 'normal Sugar behaviour', I consider it as a bug. The Contacts <-> Accounts relationship is many-to-many. I do not see accounts repeated for every contact, why do I see contacts repeated for each of the accounts?

    If I am able to change the layout templates so that I can consider it as a real many-to-many relationship (like projects or opportunities), can I also change the metadata in such a way that the account information is left out the list view (and underlying query)?

    Can anyone help here?
    Hm.. you're right. If I found some time I'll make some tests and let you know.

    Happy sugaring

  6. #6
    REByers is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    North West England
    Posts
    189

    Default Re: contact to multiple accounts

    This is a bug, and I have had it confirmed by the folks at Sugar, no fix date yet.

    The multiple relationship itself is working as designed, however it has some unexpected side effects which are the bug.

    The same thing happens with Account and Opportunities.

    What can happen here (accs and opps) is that if you create an Opportunity and link it to a single account (in the top section of the Opportunity record); then later you want to link in other accounts (in our case branch offices that needed installing as part of the Opportunity), by using the opportunities sub panel in the account screen, then Sugar changes the single account in the Opportunity to be the oldest account the Opportunity is linked to, with no notice.

    In the contact records we wanted to associate engineers with their accounts. What happens here is the same as the Opp/Acc relationship. You can attach an engineer to many accounts (using the contacts subpanel), but the contact will then have their default company (in out case their employer) record reset to be the oldest Account in the DB that they are related to.

    We've had one of our develops working on a fix. What happens, behind the scenes, it that when a related field is loaded with the screen, the detail is taken from one of the join tables. The one to one field (as appear in the form, and not the subpanels) is the first retrieved record where there are multiple instances. It seems that this intermediate table is sorted on Account, hence oldest account record appears as the default account for an Opportunity or Contact.

    Big bug for us, and quite an obvious design flaw. So much so that we are splitting up the relationships between accounts and opportunities and contacts and accounts into 2 separate relationships (a many to many, and a proper one to one) and creating news fields that work differently to the default Sugar fields.

    Once you get under the bonnet on Sugar you find it does some very strange things, at quite a basic level.
    Last edited by REByers; 2009-01-22 at 12:52 PM.

  7. #7
    tjeerd is offline Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Default Re: contact to multiple accounts

    It is in the 'listviewdefs.php'. It took me a whole evening to sort this out, because in the standard '/modules/Contacts/metadata/listviewdefs.php' I removed the 'account_id' and 'account_name' from the 'related_fields' array. But take care, your installation (like mine) can use the 'custom/modules/Contact/metadata/lisviewdefs.php' (why are these so-called 'custom' files part of a standard CE installation? Not to confuse us, I hope?). If so, repair it there also.

    [edited: I confused myself. The 'custom' subdir is filled by the Studio. Deleting the items there is not obtrusive (everything still seems to work) and Studio does not add them again.]

    Now my question is, as a sugar beginner, is this change update safe? Can we make it update safe? As I came so far already myself, can someone inform me regarding this?

    [edited: I think the safest way is to change it in the 'custom' subdir only, after you first edited your listview in Studio.]
    Last edited by tjeerd; 2009-01-23 at 06:52 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multiple Contact Relate Fields in Accounts Module
    By avadtechnologies in forum Help
    Replies: 5
    Last Post: 2012-12-26, 12:05 PM
  2. One Contact - multiple accounts ?
    By bradcook in forum General Discussion
    Replies: 13
    Last Post: 2011-06-23, 10:31 AM
  3. Replies: 1
    Last Post: 2008-09-02, 09:00 PM
  4. Replies: 0
    Last Post: 2007-03-07, 07:36 PM
  5. 1 contact, multiple accounts
    By dilvie in forum Feature Requests
    Replies: 0
    Last Post: 2005-07-09, 04:10 AM

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
  •