March 6, 2017 Chloe McAllister

Relationships, Relate and Flex Relate Fields

You can create connections between modules in three different ways in SugarCRM. These are: Relationships, Relate fields and Flex Relate fields. But what’s the difference?

Relate fields and Flex Relate fields are quite similar. Their main difference is that Relationships are a two-way connection and Relate and Flex Relate fields are just a one-way relationship.

Relationships

A two-way Relationship between modules can be built by navigating to Studio, accessing one of the relating modules and opening the relationship window.

Add a relationship SugarCRM

When creating Relationships between modules, fields and/or subpanels will automatically be created to represent this two-way connection. There are three different types of Relationships you can build: One-to-One, One-to-Many and Many-to-Many.

The One-to-One relationship. This type of relationship will result in a relationship field in each module where a record of the opposite module can be selected. It is the most restrictive relationship as the relationship field can only hold the value of one record opposed to subpanels, which represent the ‘Many’ option in a Relationship and can hold multiple records. A One-to-One relationship between Accounts and Contracts means that each Account record can only be connected to one Contract and that each Contract record can only be connected to one Account record.

One to One relationship SugarCRM

 

The One-to-Many relationship. This will place a relationship field in the secondary module, similar to the One-to-One relationship while the primary module will contain a subpanel where multiple records may be connected. Because of this difference, it is important to ensure that the module you create the relationship from in Studios’ Relationship window is the module with the ‘ONE’ relation. For example, the Accounts module has a One-to-Many relationship with the Contacts module. This means an Account record contains a Contacts subpanel and may have a relationship with multiple Contacts. A Contact record contains an Account field as it can only be related to one Account.

One to many relationship SugarCRM

The Many-to-Many relationship. This will display a subpanel in both modules. It will allow both of the modules to be related to one or more records. For example, if you have a Many-to-Many relationship between Accounts and Documents, then an Account record can be related to one or more Document records and will display a Documents subpanel in the Account record. The Document can also be related to one or more Account records and will display an Accounts subpanel.

When building Relationships you also have the ability to build a connection to the same module. An example of where you might require a relationship like this is when you have a parent and child Account relationship, therefore the child Accounts would have a ‘Member of’ relationship to the parent Account – a One-to-Many relationship between Accounts and Accounts.

Member of relationship SugarCRM

The great thing about creating relationships in SugarCRM is that they enable you to view and access the module records from both the primary and related record either via the relationship field or subpanel. This makes reporting easy and accurate as you can use fields from the related modules as well.

Relate Fields

Relate fields create a one-way relationship between two modules. Unlike with Relationships, you will not see a Relationship field or subpanel in the related modules’ record. You can only see the Relate field with the associated module link in the primary module. For example, a Contact Relate field in the Cases module will appear on the Case record as a hyperlink to the related Contact which could be the main contact you are dealing with. But if you access the Contact record you will not see any evidence of a relationship to that specific Case record.

Related contact SugarCRM

Relate fields are great if you only need to know from one end of the relationship information from the related module, and they are really easy to create.

Flex Relate Fields

These are similar to Relate fields in that it also creates a one-way relationship to the related module. However, with the Flex Relate field the user has the freedom and ability to choose a related record from any module. When a user is in a record that has a Flex Relate field they are presented with a dropdown list which will in edit mode show all available modules that they can pull into that field. A good example of this is the stock ‘Related to’ field in the Notes module where the user can choose to relate a Note to any record from any module in the system.

Flex relate SugarCRM

All types of relationships can be built in Studio. Relationship fields and subpanels created from Relationships will automatically be added to the modules layout by default, whereas the Relate and Flex Relate fields will need to be added to the Record View layout in Studio manually.

Chloe McAllister
Chloe McAllister

Latest posts by Chloe McAllister (see all)

CONTACT US!

+44 1733 609 100