Introduction to Relationships and Relate Fields
Linking various pieces of information together is a vital function of CRM. Sugar® provides three different ways to create connections between modules:
- Relationships: Links between different modules in Sugar that allow records between those modules to be related.
- Relate fields: Fields that associate a record with another module's record in a one-way fashion, in which the related module is always the same.
- Flex Relate fields: Fields that associate a record with another module's record in a one-way fashion, in which the user can choose the related module.
Relationships create a bidirectional connection between two modules. Record A has a link to record B, and record B has a link to record A. Relate and Flex Relate fields, on the other hand, both create a one-way connection between two modules. Record A has a link to record B, but record B shows no reference to record A.
Both relationships and relate-type fields can be created in Studio for existing modules or in Module Builder when creating a new module.
In Sugar, relationships can be created in either Module Builder (for new custom modules) or Studio (for existing custom and stock modules). When a relationship is created via Admin > Studio, relate fields based on the relationship and/or subpanels are automatically created to represent a two-way connection between the modules. When a related record is selected in another record's subpanel or relate field based on a relationship, a relationship is established in Sugar's database between the two records. There are three different relationship types as follows:
- One-to-One: One record in the primary module can be related to just one record in the secondary module and vice versa.
- One-to-Many: The primary module's record will be on the "one" side and show a subpanel containing records from the "many" side.
- Many-to-Many: This type of relationship allows for both sides to be connected to one or more records on the other side.
For more information about relationship types, please refer to the article Understanding Relationship Creation Options.
You can also create a circular relationship, which is a module related to itself. A good use case for this is a parent/child relationship within the same module, such as the stock Parent Account field. Circular relationships can be created using any of the above relationship types.
Detailed steps for relationship creation can be found in the article Creating a Relationship.
Sugar administrators can create relate fields via Admin > Studio, which creates a one-way relationship between two modules. You can add multiple relate fields in a module. Unlike relationships in Sugar, you will not see a relate field or subpanel in the related module record when using the relate-type field. You will only see the relate field and the associated module link in the module where the relate field exists.
For example, a contact relate field for the Cases module will appear on the case record as a hyperlink to a related contact. But if you were to click on the hyperlink to view the contact, you would not see any evidence of the case relationship on the contact record or in its subpanels.
When a relationship exists between two modules, a new custom relate-type field will have no effect on that existing relationship. Relationships automatically generate a relate field and subpanel between the modules due to the two-way relationship, which is separate from a relate-type field.
Detailed steps for relate field creation can be found in the article Creating a Relate Field.
Flex Relate Fields
Flex relate fields are similar to relate fields in that both create a one-way relationship to the related module, but with flex relate fields, the user has the freedom to specify a related record from any module. The user is presented with a dropdown list of available modules when they edit a flex relate field. A good example of a flex relate field 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.
Note: You can only add one flex relate field to a module, so if a flex relate field already exists in a module, you will not see "Flex Relate" as an option in "Data Type" when creating the field in Studio.
Detailed steps for creating flex relate fields can be found in the article Creating a Flex Relate Field.
Similarities and Differences
- Both the relate- and flex-relate-type fields will appear as editable fields in Studio once created.
- When editing a record, the relationship's relate field and the relate type field will appear in the same format. The flex relate type field is unique because it will contain the dropdown list to select a module to relate the record to.
- In record view layouts, the relationship's relate field, relate type, and flex relate type fields will all appear the same. All three fields will show the record name with a hyperlink to view the related module record.
- Relate type fields created in Studio will have database names ending in "_c", while the database name of a relationship's relate field will not end in "_c". Third-party tools such as the Chrome browser's "Inspect Element" can be used to display the database name to distinguish the fields.
- Relate fields created from relationships are automatically added to the module's layout by default. However, the relate-type and flex-relate-type fields will need to be added to the record view layout by the administrator.
Deciding Which Type to Use
Before creating a relationship, relate field, or flex relate field, please consider the key features of each type to determine which one best meets your organization's needs.
Use relationships when you wish to create a two-way connection between two modules (e.g. Accounts and Contacts).
- Advantages: Using a relationship is logically and structurally very powerful. You will be able to view and access the module record from both the primary and related module record via a subpanel or the relate field created by virtue of the relationship. When creating a report for the primary or related module, you can access and select the related module's fields to include in the report.
- Disadvantages: Extensive use of relationships in addition to calculated fields may affect your instance's performance.
Use relate fields to create one-way relationships between two modules where the module in which the relate field exists (e.g. Cases) displays the record link to the related module (e.g. Contacts) record.
- Advantages: Relate fields are easy to create and do not affect performance.
- Disadvantages: Only the target module (Cases) will display the related module (Contacts) record via the relate field and enable access to that record. You will not be able to view any information on the target module (Cases) record from the related module (Contacts) record.
Use a flex relate field if you wish to have the ability to choose from a list of modules when creating and editing the primary module record. Please note that this creates a one-way relationship between both modules just like the relate field.
- Advantages: Flex relate fields provide the flexibility to relate a record from a variety of modules to the target module record. Flex relate fields do not affect performance in Sugar.
- Disadvantages: Only one flex relate field can be used in each module. Also, only the target module record will display the related module record via the flex relate field and enable access to that record. You will not be able to view any information on the target module record from the related module record.
Note: Occasionally, multiple fields can have the same display label. For example, if you see two relate fields in the Bugs module labeled "Contact Name", you can temporarily change one of the field names in Studio to distinguish between the two. Alternatively, Google Chrome's "Inspect Element" option can also be used to help identify the database names of the fields displayed in the module's layouts. Since every field in Sugar has a unique database name, this will help to distinguish between the fields.
Last modified: 2021-02-02 17:36:05