The stock Accounts-Contacts relationship is a many-to-many relationship. This means that a single account can be related to multiple contacts, and a single contact can be related to multiple accounts. The Sugar user interface, however, presents the relationship as if it were a one-to-many where a single account can relate to multiple contacts, but a single contact relates to only one account. As a result, some confusing behaviors can be experienced when working with accounts and contacts in Sugar.
Using the Accounts-Contacts Relationship
Normally, a many-to-many relationship would cause subpanels to display for both sides of the relationship. For the stock Contacts-Accounts relationship, an Account Name field appears on the Contacts module rather than a subpanel. We will walk through an example in order to understand how the relationship works in the Sugar user interface.
Each contact has an Account relationship field, “Account Name”. This field allows for the selection and display of a single account. Below, we have created a contact, Adam Adamson, and related him to the account, Green Tractor Ltd.
Each account has a Contacts subpanel. This subpanel allows for the selection and display of multiple contacts. Navigating to view Green Tractor’s details, Adam Adamson is listed in the Contacts subpanel.
In this way, the relationship appears as a one-to-many even though it is technically many-to-many.
Relating Contacts to Multiple Accounts
Some organizations may benefit from leveraging the true, many-to-many nature of the Accounts-Contacts relationship. Contact records may be related to multiple accounts via the Contacts subpanel while viewing the desired account. Use the following steps to relate a single contact to a second account record:
- Start with a contact (e.g. Adam Adamson) who is already related to a single account (e.g. Green Tractor Ltd).
- Navigate to a second account’s record view (e.g. Grow-Fast Inc.).
- Scroll to the Contacts subpanel and select “Link Existing Record” from the Actions menu.
- Search for the contact, select its checkbox, and click “Link”.
The contact will now appear in the Contacts subpanels of both account records.
When viewing the contact record in record view, only one of the accounts, chosen at random, will be displayed.
Creating a Custom Relationship
If your organization’s business process would benefit from the full functionality of a many-to-many relationship between contacts and accounts, an admin user may create a second, custom relationship to house this information. The stock Accounts-Contacts relationship cannot be deleted, but the Account Name field can be removed from the Contacts layouts and the Contacts subpanel can be renamed and moved to the bottom of the list of Accounts subpanels. For more information about creating new relationships and removing fields from layouts, please refer to the Studio documentation. As an alternative, the stock Accounts-Contacts relationship may be used to denote a contact’s primary account while the custom relationship houses non-primary accounts.