Creating record associations
While creating a record association, you specify the following parameters for the association:
- Cardinality—Type of relation between the records within the association, such as one-to-one, one-to-many, and many-to-many.
- Constraint—Limitation for an association, such as automatic deletion of the associated records. If record1 is associated with record2, and you delete record2, then record1 is also deleted automatically.
- Referential integrity—Determines whether BMC Helix Innovation Studio (IS) checks that child records reference valid parent records. When referential integrity is enforced, IS performs integrity checks, including validation, cascade delete, and modality checks, for all associations of the related records. If a related record has multiple associations and any one of them is not enforced, IS skips all these integrity checks for that record. 
Types of associations
The following table describes the different types of associations:
| Type of association | Description | 
|---|---|
| Direct association | Defines a direct relationship between the two records in the association, such as one-to-one and one-to-many relationships. Multiple fields of one record and multiple fields of other records can be a part of the association. Entries in two forms contain direct references to each other. For example, see the following image: 
 | 
| Indirect association | Defines an indirect relationship between two records in the association; the records can be related to each other by using a third record, such as a many-to-many relationship. Entries in two related forms do not have references to each other. For example, see the following image: 
 | 
| Self association | Defines a relationship in which a record definition is associated with itself through a direct relationship. For example, an employee-manager association. A manager belongs to the manager role, and a manager also belongs to an employee role. The following image illustrates a self-association: 
 | 
To create a record association
The following video shows how to create a record association. The video shows an older version of BMC Helix Innovation Studio. The previous product name was BMC Helix Platform. Although there might be minor changes in the UI, the overall functionality remains the same:
- Log in to BMC Helix Innovation Studio and navigate to the Workspace tab.
- Select the application or the library for which you want to create an association.
- Select Associations > New.
 The Create association window is displayed as shown in the following image:
           
- Complete the fields as described in the following table: - Field - Action - Association name - Enter a unique name that identifies the association. 
 The association name must start with an alphanumeric character. Only alphanumeric characters, hyphens, underscore, and spaces are allowed in the association name.- (Optional) Description - Provide a short description of the association. - First record - Select the source entity or the starting point of your association. - Important: The Application/Library scoped definitions are marked with an asterisk ( * ). Make sure you follow the guidelines listed in Object-definition-scope before you select these definitions. - (Optional) First record's role - Provide a description for the first record, which explains the record in the context of the association. - To associate two records from a process, if you use the Associate Records element and select the Use Default Roles toggle key, the value you specify in First record's role is used. For more information about associating records from a process, see Creating-associations-using-the-Association-Service-Task. - Cardinality - Select any one of the following relationships for the record definitions: - If you want to create a direct record association, select the cardinality as Has One or Has Many.
- If you want to create an indirect record association, select the cardinality as Many To Many.
 - Important: You can create an association between existing record definitions by using the key fields only if you select Has One or Has Many from Cardinality. For more information, see first record key field. - Second record - Select the target entity or the ending point of your association. You can select child and audit records as secondary records. - Important: - The Application/Library scoped definitions are marked with an asterisk ( * ). Ensure that you follow the guidelines listed in Object-definition-scope before you select these definitions.
- Create an association between the parent and the audit record when audit is enabled on the parent record.
- When creating an association between the parent and the audit record, do not set the cardinality to Has One.
 - First record's key field - Select a field from the first record definition to create a direct association between the first and second record definitions. - By default, in the First record's key field, ID is selected. - (Optional) Second record's foreign key field - Select a field from Second record to create a direct association between the record definitions selected from First record. - If you don’t select any value from Second record's foreign key field, a unique key field is automatically added to the second record definition. This field refers to the ID field from the first record definition. 
 For example, If you select Organization from First record and Person from Second record and no value from Second record's foreign key field, the ORGANIZATION_ID field is added to the Person record definition.- (Optional) Second record's role - Provide a description for the second record, which explains the record in the context of the association. 
 To associate two records from a process, if you use the Associate Records element and select the Use Default Roles toggle key, the value you specify in First record's role is used. For more information about associating records from a process, see Creating-associations-using-the-Association-Service-Task.- Constraints - To create a direct association, select any of the following constraints: - Enforce referential integrity—If enabled, BMC Helix Innovation Studio performs integrity checks, including validation, cascade delete, and modality checks, for all associations of the related records.- When you select the Enforce Referential Integrity checkbox, all options under Constraints are enabled. For example, the Cascade delete option functions according to its default behaviour.
- When the Enforce Referential Integrity checkbox is unchecked, all options under Constraints are disabled.
- When you create a new association, this constraint is enabled by default.
- If a related record has multiple associations and any one of them is not enforced, BMC Helix Innovation Studio skips all these integrity checks for that record.
- Referential integrity can be enforced during association creation. It cannot be modified later.
- Referential integrity cannot be enforced for many-to-many cardinality.
 
 - If record is deleted, delete all associated records—Deletes all the associated records if the first record is deleted. This constraint adds a Cascade delete flag to the record association. This constraint is available only when you select the Enforce referential integrity checkbox. 
- Require a record to be associated in order to create a new record—Creates the second record only when the first record is created. This constraint is available only when you specify to delete all the associated records if the first record is deleted.
 - Important: - A direct association is automatically created when you select any of the constraints.
 - Scope/Customization options - Option to define the scope for association definition. This option further contains the following options: - Application/Library (default)—To limit the use of the definition within the same Digital Service application or library.
- Public—To enable the definition to be used by all the applications or library and allow customizations for this definition.
 - Enable association - Select this item to validate and implement the association in the two records. 
- Click Save.
Where to go from here
| Action | Reference | 
|---|---|
| Create a new record definition or modify an existing record definition by using Record designer. | |
| Create a record instance. | |
| Enable row-level security by using security labels. | 
 



