An association is an Action Request System object that describes relationships between entries in AR System forms. The association enables you to manage relationships between entries in two forms to support referential integrity, cascade deletes, and archiving related entries.
An association defines a relationship between entries in two forms. The relationship can have three cardinality options: one-to-one, one-to-many, and many-to-many. For one-to-one and one-to-many relationships, an association between two forms is defined by specifying one form as primary and another form as secondary. For these relationships, the primary form can have only one entry in the relationship. For many-to-many relationships, there are no primary and secondary forms.
AR System associations are used in a BMC Helix ITSM application primarily for archiving. You can also use these associations with RESTful APIs to get related entries. For more information, see Overview of the REST API.
The following video (6:25 minutes) explains how you can use associations to establish relationships between entries in two AR System forms to support referential integrity, cascade deletions, and archiving related entries. (The interface reflects version 9.1.)
Benefits of associations
You can use associations to describe the data model for an application. Enforced associations can eliminate the need to create workflow to restrict operations or to remove related data when an entry is deleted. Reducing the amount of workflow needed for an application makes it easier to understand your applications. Associations can also be used to govern the behavior of archive definitions. For more information, see Configuring data archiving associations for related forms.
Each association has cardinality, which dictates how the entries in the two forms are related. The options are:
- One to One—A relationship in which an entry from the primary form can be related to zero or one entry in the secondary form.
- One to Many—A relationship in which an entry from the primary form can be related to zero or more entries in the secondary form.
- Many to Many—A relationship in which an entry from the primary form can be related to zero or more entries on the secondary form and an entry from the secondary form can be related to zero or more entries on the primary form.
All cardinality options may have an entry that is related to no other entries. For example, a one-to-one relationship between an employee and email address includes the possibility that an employee might not have any email addresses.
Data relationships defined by associations may be enforced (strong) or not enforced (weak).
If an association is defined as enforced, the AR System ensures data integrity is maintained. Data integrity means that the server will enforce the cardinality of the association and will ensure referential integrity. Thus, an entry will not be able to refer to another entry that does not exist. Associations enforced on forms are also enforced on the archives of those forms.
Only one-to-one and one-to-many cardinality can be enforced. You cannot create an enforced many-to-many relationship. The server performs the following functions for an enforced association:
- If an entry is deleted from the primary form, the server deletes all related entries from the secondary form (cascade delete).
- The server does not allow duplicate primary key values in the primary form. For example, each employee must have a unique ID.
- The server does not allow entries in the secondary form with invalid foreign key values. For example, an entry in the contact form must reference a valid employee.
- The server does not allow changing primary key values in the primary form if they are referenced in a secondary form. For example, you cannot change an employee ID if that employee is referenced in a birth information form.
- For one-to-one associations, the server does not allow the creation of entries in the secondary form if that breaks the cardinality defined by associations. For example, it will not allow the creation of a second birthday entry for the same employee.
If an enforced association is created between forms that already contain data, the existing data does not need referential integrity. However, any changes to the data after the association is created will follow enforcement and should have referential integrity.
If an association is not enforced, the AR System server allows the creation of records even if the creation breaks the cardinality defined by the association or the referential integrity. If an association is not enforced, the server does not perform the actions listed above for enforced associations.
Unenforced associations provide a way to describe data relationships that the server does not directly enforce. These associations may be otherwise enforced by defining workflows in Developer Studio.
The Data Import tool has an option to disable association enforcement while importing data. For more information, see CLI migration options for mapping form data and objects. The ARMergeEntry API also provides an option to disable association enforcement.
Type of associations
Entries in forms may contain direct references to each other, or may be related through a third form that contains references to each of the related entries. The association type describes which of these approaches is used.
Can be enforced?
Direct associations are primary key and foreign key associations between two forms.
Multiple fields from main form can be used as a primary key and similarly multiple fields from the secondary form can be used as a foreign key. In other words, each field of the primary key maps to a field in the foreign key and is called direct association.
External associations are created by using a third form. This third form, called an association form, stores the foreign key for both the primary and secondary forms. Multiple fields from the primary form can be mapped to the same number of fields on the association form, and multiple fields from the secondary form can be mapped to the same number of fields on association form.
Direct associations involve only two forms, and require that references from one form to the other use only data that is present on the forms. Direct associations can be used for one-to-one and one-to-many relationships. They cannot be used for many-to-many relationships. In the following example, the Employee Phone form directly holds reference to Emp ID of the Employee form, as shown in the following image:
Indirect associations include a third form that contains references to each of the related forms. Entries in the two related forms in an indirect association do not have references to each other. Indirect associations can be used for any kind of relationship, and only an indirect association can be used for a many-to-many relationship. In the following image, the Employee-Department form (third form) contains references to the two related forms: Employee and Department:
Whether the association is enforced, for an indirect association, the server always deletes related entries from association form if an entry is deleted from primary or secondary form.
When defining an association, you can specify a qualification for each of the forms involved. Qualifications allow different relationships between entries in the same two forms or the storage of multiple relationships in a single indirect association form.
When you specify qualifications, only entries matching the qualification are related to the association. For example, you might have a Phone details form that includes a Phone Type field indicating that an entry is an office phone number or another type of phone number. You could then create different associations between an employee form and a phone details form:
- One-to-one association between an employee and an office phone
- One-to-many association between an employee and all other phones
You would add a qualification in the first association requiring that the field on the telephone number form be office phone option.
An association object does not have any permissions. Only administrators are allowed to create, modify, and delete associations. All other users can view an association, if they have access for viewing all the fields and forms used in that association.