# Quality Relationship Automation (QMS)

QMS Admins can configure certain [complex join relationship objects](/en/lr/28740/#many_to_many) to be automatically bidirectional once established. This can link two records of the same object together, such as the _Related Quality Event_ object in QMS, and these relationships can optionally describe the [nature][1] in which the two records are linked. This streamlines the way in which users identify related records, reduces the amount of effort required to link records of the same object, and means that users only need to reference one page section when reviewing all links between such records.

This two-way relationship is supported for the following source and related objects:

- _Quality Event_ (`quality_event__qdm`)
- _Audit_ (`audit__qdm`)
- _CAPA_ (`capa_action__qdm`)
- _Change Control_ (`change_control__v`)
- _Change Plan_ (`change_plan__v`)
- _Deviation_ (`deviation__v`)
- _Finding_ (`finding__v`)
- _Lab Investigation_ (`lab_investigation__v`)
- _Continuous Improvement_ (`continuous_improvement__v`)
- _Nonconformance_ (`nonconformance__v`)
- _MedTech CAPA_ (`medtech_capa__v`)
- _Field Corrective Action_ (`field_corrective_action__v`)
- _Health Hazard Evaluation_ (`health_hazard_evaluation__v`)

## How Automated Quality Object Relationships Work

Administrators can configure the _Quality Relationship Automation_ component to be active for any object type of the _Related Quality Event_, _Related Audit_, or _Related CAPA_ objects. Once configured, new records of those object types are automatically duplicated in the inverse direction whenever a user relates two _Quality Events_, _Audits, or CAPA-Quality Events_ via records of this object. This means that no matter which side of a related record set a user views, the user can reference one section on the page to see all inbound and outbound links to other records of the same object.

Note that since there are two records to describe the same relationship but in inverse directions, ensure that you configure reports to only show either outbound or inbound related records of this type, or else you may see more data than you expect in your solutions.

### About Paired Related Object Records

Vault synchronizes some key data between records in a two-way relationship. On creation of a new record, for most custom field data types, Vault copies the specified value on the user-created record to the same field on the inverse record. If the _Relationship Nature_ field is changed on either side of a paired set of related object records, Vault updates the inverse paired record's _Relationship Nature_ field based on your [nature configuration][1] with the same or inverse value. Vault does not synchronize changes to other fields made after the initial save.

Certain fields, such as formula fields or system provided fields like _Lifecycle_ or _Lifecycle State_ are excluded from this synchronization, as they are unique to each record's configuration. Certain fields on the paired related object records can't be updated by users. Vault displays an error if a user attempts to update the _Reciprocal Link ID_ or _Related \[Quality Object\]_ field.

Vault captures any errors encountered while attempting to create the two-way record link in the _Create Reciprocal Link Error_ field. Consider creating a dashboard, flash report, or a job to make visible any configuration issues leading to record creation failures during configuration and verification activities.

## Setting Up Quality Relationship Automation

Configure the following Vault components to start using automated quality object relationships in your Vault:

  *   Add or adjust related object sections to the applicable Quality [object page layouts][2].
  *   Review the [_Related Event Type_ picklist][4] to ensure that entries for your desired objects are active.
  *   [Define][1] _QMS Record Relationship Natures_.
  *   Create _Quality Relationship Automation_ [configurations][3].

### Configuring the Quality Object Page Layout {#object-page-layout}

On each applicable Quality object page layout, add a related object section for the _Related Quality Event_, _Related Audit_, or _Related CAPA-Quality Event_, respectively. Because related objects are duplicated by relationship automation, we recommend adding the section for only the outbound relationship. This ensures that the current record is referenced in the _Quality Event_ field of the related records displayed on a given quality object record.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Do not enable the <em>Do Not Copy</em> checkbox on the <em>Reciprocal Link ID</em> (<code class="language-plaintext highlighter-rouge">reciprocal_link_id__v</code>) field on the <em>Related CAPA</em>, <em>Related Quality Event</em>, <em>Related Audit</em>, or <em>Related Event</em> objects. Enabling this attribute on this field will cause unexpected errors.</p>
    </div>
  </div>
</div>



### Configuring the Related Event Type Picklist {#related-event-type-picklist}

Configure the entries on the _Related Event Type_ picklist to ensure that they are active. Inactive entries are not available for _Quality Relationship Automation_ configurations. For example, add entries for the _Field Corrective Action_ and _Health Hazard Evaluation_ objects to the picklist to ensure that users can link _Quality Event_ records to _Field Corrective Actions_ or _Health Hazard Evaluations_ records.

### Defining QMS Record Relationship Natures {#defining-natures}

You can define the natures available to users when they relate two Quality objects by creating values in the standard picklist _QMS Record Relationship Nature_, which does not have any values defined by default. If you want to allow users to describe relationship natures in this way, you must first define the relationship natures in base/inverse pairs, such that this picklist represents all values which could describe either directionality of two records being related to one another. When later mapping these nature values as base/inverse pairs, you must define both sides of the nature. This has the effect of creating a descriptive statement within the related object section.

For example, if you define a nature as _Duplicates_, you may define a second picklist value to describe that nature's inverse, such as _Is Duplicated By_. If you then have two _Audit_ records, _AUD-032_ and _AUD-045_, a user could add _AUD-045_ as a related record on _AUD-032_ and select _Duplicates_ as its nature. Then, when any user views _AUD-045_, its related object section would describe the relationship as "_AUD-0045_ _Is Duplicated By AUD-032"_, providing a clear description of the link between the two records.

You can also define "simple" relationship natures which do not have an inverse mapping. For example, _Is similar to_. When a user selects a value during the creation of a related record object record when there is no inverse mapping configured, the paired related object record's configured picklist has the same value as the initial record.

### Creating Quality Relationship Automation Configurations {#relationship-automation-configurations}

Each _Quality Relationship Automation_ configuration component establishes a two-way relationship between Quality records of the same object type. Within configurations, you can map values to allow users to describe the nature of these relationships when they are created.

To create a _Quality Relationship Automation_:

  1.  Navigate to **Admin** > **Configuration** > **Quality Relationship Automation**.
  2.  Click **Create**.
  3.  Enter a **Label**.
  4.  Select a Quality object from the **Object** drop-down. [Locked objects](/en/lr/15298/#locked-objects) are not available to select.
  5.  In the **Source / Left Hand Field** drop-down, select the parent object reference field. For example, _Audit_. This field must be a _Parent Object_ reference field.
  6.  In the **Target / Right Hand Field** drop-down, select the object reference field on the same object. For example, _Related Audit_. This field must be a _Related Object_ reference field to the same object selected as the _Source/Left Hand Field_.
  7.  In the **Picklist / Relationship Values** drop-down, select any picklist field on the specified object which targets the _QMS Record Relationship Natures_ picklist.
  8.  Optional: In the value mapping section, click **Add Mapped Value** and choose a base nature and its inverse. Choose whether the mapping is _Active_ or _Inactive_. You can add additional mappings by clicking (**+**). You do not need to define any base/inverse mappings for the picklist if your relationships can be described with a single value, such as _Is similar to_.
  9.  Click **Save**.

If necessary, create additional _Quality Relationship Automation_ configurations for each applicable Quality object type.

## Related Permissions

The following permissions affect Quality object relationship automation, in addition to permissions to the _Join_ objects and fields:

|Type|Permission Label|Controls|
|--- |--- |--- |
|Security Profile|Admin: Quality Relationship Automation|Ability to view, create, edit, or delete _Quality Relationship Automation_ configuration components.|

  [1]: #defining-natures
  [2]: #object-page-layout
  [3]: #relationship-automation-configurations
  [4]: #related-event-type-picklist
