# Setting Up Related Record Automation (QualityOne)

[QualityOne Vaults](/en/lr/78610/) allow you to automate quality processes in your QualityOne Vault. You can do this by creating related record and related child record components to instruct Vault to create specific related records and related child records ([inbound relationships](/en/lr/28740/#how-to-view-relationships)) that are automatically populated with a source record's field values when the source record enters a particular lifecycle state. You can also utilize custom objects and fields when creating components. When you set up related records, Vault creates a _Component_ type of that relation. You can create the relation by associating the new (related) record to the source record. To automate related records, you must configure entry actions of the selected source object's lifecycle to automate the creation of related records and related child records when their source record enters a particular object lifecycle state. You can also allow the user to trigger the action by configuring the user action of the selected source object.

<a href="https://platform.veevavault.help/assets/images/CPC-General-RelatedRecordSetup.png" data-lightbox="CPC-General-RelatedRecordSetup.png" data-title="" data-alt="Related Record Setup">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/CPC-General-RelatedRecordSetup.png" alt="Related Record Setup" style=""  />
</a>

## About Related Record Setup {#about}

Vault can relate a newly created record to a source record if you associate a source object with another object, the related object. You can map the source object field values to the related object field values when you have set up the related records. You can also associate a source-child object (inbound relationship) with a related-child object (inbound relationship) and map their field values. Before [incorporating entry actions][1] into your source object lifecycles, you must set up the relationship between your source object and related object.

### Object Relationship {#object-relationship}

A _Source Object_ is an object from which you want to source values, which you can do by associating it to a _Related Object_. A _Related Object_ is the object that you want to automatically generate a new record for when a particular object lifecycle state of the source object is met, with the values sourced from the source object automatically populated on the record. You can configure specific _Source Object Types_ and _Related Object Types_ when it is applicable.

#### Related Child Records {#related-child-records}

When creating a relation between two (2) parent objects (_Source Object_ and _Related Object_), you can associate the corresponding child objects for automated child record generation. You can do this by configuring a source object's child object (the _Source-Child Inbound Relationship_) and a related object's child object (the _Related-Child Inbound Relationship_).

### Field Value Mapping {#field-value-mapping}

When creating a relation between two (2) objects or two (2) child objects, you can map multiple field values between the two (2) objects. The generated related record and related-child record will contain the same field values copied from the source record and source-child record. You can map field values between each other only when the data type matches, for example:

* _Number_ type to _Number_ type
* _Text_ type to _Text_ type
* _Long Text_ type to _Long Text_ type
* _Date_ type to _Date_ type
* Object reference fields to object reference fields
* Picklist to picklist (so long as both lists contain the same list values)

You can map to an object reference's field (second-level) within the source object's configuration. For example, the _Source Object NCR_ and its object reference _Defect Category_ would have a _Description_ field showing a _Default Value_ of "Defect Category > Description" to map to.

### Example Use Cases {#example-use-cases}

There are different potential example use cases for using Related Record Setup:

* **Use Case 1**: Automatically create an _Effectiveness Check_ record when all _Action Items_ are completed and an _NCR_ record enters into the _Effectiveness Check_ _Lifecycle_ state.
  * Example _Source Object_ is _NCR_ and the _Related Object_ is _Effectiveness Check_.
  * Example field value to map is the _Result_ field on the _Effectiveness Check_ object to the _Investigation Summary and Conclusion_ field on the _NCR_ object.
* **Use Case 2**: Automatically create an _NCR_ record with information from a _Complaint_ record when the nonconformance is required and automatically create an _NCR-Product_ child record with information from a _Complaint-Product_ child record.
  * Example _Source Object_ is _Complaint_ and the _Related Object_ is _NCR_. Example _Source-Child Inbound Relationship_ is _Complaint-Product_ and the _Related-Child Inbound Relationship_ is _NCR-Product_.
  * Example field value to map is the _Complaint Summary_ field on the _Compliant_ object to the _Defect Description_ field on the _NCR_ object. Example child field value to map is the _Product_ field on the _Complaint-Product_ child object to the _Product_ field on the _NCR-Product_ child object.
* **Use Case 3**: Automatically create a _Supplier NCR_ record if the COA Analysis fails and supplied material is outside of its tolerances (USL and LSL).
  * Example _Source Object_ is _Inspection_ and the _Related Object_ is _NCR_.
  * Example field value to map is the _Purchase Order_ field on the _Inspection_ object to the _Purchase Order_ field on the _NCR_ object.
* **Use Case 4**: Automatically create an _Inspection_ record when the _Purchase Order Line Item_ record is created.
  * Example _Source Object_ is _Inspection_ with _Source Object Type_ as _Incoming Inspection_ and the _Related Object_ is _Purchase Order Line Item_.
  * Example field values to map are:
    * The _Purchase Order_ field on the _Purchase Order Line Item_ object to the _Purchase Order_ field on the _Incoming Inspection_ object type;
    * The _Supplier_ field on the _Purchase Order Line Item_ object to the _Supplier Name_ field on the _Incoming Inspection_ object type.

## Setup Overview {#overview}

Setting up your Vault to use Related Record Setup involves the following steps:

* [Activate the _Related Record Setup_ pages][2]
* [Set up a related record component and a related child record component][3]
* [Configure field value mappings for the related record component and the related child record component][4]
* [Configure the _Create Related Record_ action on the source object and its lifecycle][1]

<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>: Depending on your Vault’s creation date and which features are currently enabled and configured, some of the steps described in this article may be unavailable or already complete in your Vault.</p>
    </div>
  </div>
</div>



## Activating Related Record Setup {#activate-rrs}

Before creating related record components, you must activate the appropriate _Related Record Setup_ pages and [ensure that the appropriate Admin users][5] have _View_ access for each page.

## Setting Up Related Record Components {#setting-up}

To set up related records, you must create related record components by associating two (2) existing objects (possibly parent objects), and if applicable, you must also create related child record components within each related record component. A related record component must exist to create a related record component but, a related child record component does not need to exist for a related record component to be created.

### Creating Related Record Components {#create-rrc}

To create related records by associating objects:

1. Navigate to **Admin > Configuration > Component Setup > Related Record Setup**.
2. Click **Create**.
3. Enter a **Label** for the automated related record creation. We recommend that the naming convention be clear to convey the association between the source object/object type and the related object/object type. Only the label is visible when you are [configuring an entry action][1] for the related record component.
4. Select a **Source Object** and a **Source Object Type**. You can add more than one (1) **Source Object Type** if needed.
5. Select a **Related Object** and a **Related Object Type** if applicable.
6. Select an **Outbound Reference Field**.
7. Click **Save**.

### Creating Related Child Record Components {#creating-rcrc}

To create related child records by associating child objects:

1. Navigate to the appropriate related record component.
2. Click **Add** in the _Related Child Record Setup_ section.
3. Enter a **Label** for the automated related record creation. We recommend that the naming convention be clear to convey the association between the source child object and the related child object. Only the label is visible when you are [configuring an entry action][1] for the related child record component.
4. Select a **Source-Child Inbound Relationship**.
5. Select a **Related-Child Inbound Relationship**.
6. Click **Save**.

### Deleting Related Records Components {#deleting-rrc}

To delete related record components, navigate to **Admin > Configuration > Component Setup > Related Record Setup** and click **Delete** from the component's inline **Actions** menu. Click **Continue** to proceed with the component deletion. You can also delete from within the component's details page from the **All Actions** menu.

To delete related child record components, navigate to the appropriate related record component and click **Delete** from the related child record component's inline **Actions** menu. Click **Continue** to proceed with the component deletion.

## Configuring Field Value Mapping {#configure-fvm}

When creating a relation between objects, fields need to be configured for values to be mapped from the source. Configuring field value mappings is optional when creating related record components unless the configured related object and related-child object contains required fields. If a required field on a related object and related-child object does not have a field value mapping, Vault will not generate new records when _Create Related Record_ action is triggered.

### Configuring Mappings for Related Record Components {#fvm-rrc}

* [Create one (1) or more field value mappings for related record components][6]
* [Edit field value mappings for related record components][7]
* [Delete field value mappings for related record components][8]

#### Creating Field Value Mappings for Related Record Components {#creating-fvm}

1. Navigate to **Admin > Configuration > Component Setup > Related Record Setup**.
2. In the row for the appropriate component, click **Edit** from the inline **Actions** menu.
3. Click **Add** in the _Field Value Mappings_ section.
4. Enter a **Label**.
5. Select a **Related Object Field**.
6. Select a **Default Value**. This value belongs to the _Source Object_ and _Source Object Type_.
7. Click **Save**.

Repeat as needed until you have the required list of field value mappings.

#### Editing Field Value Mappings for Related Record Components {#editing-fvm}

1. Navigate to **Admin > Configuration > Component Setup > Related Record Setup**.
2. In the row for the appropriate component, click **Edit** from the inline **Actions** menu.
3. In the _Field Value Mappings_ section, click on the desired mapping to view.
4. Click **Edit**.
5. Modify any of the following fields needed: **Label**, **Related Object Field**, and **Default Value**.
6. Click **Save**.

#### Deleting Field Value Mappings for Related Record Components {#deleting-fvm}

1. Navigate to **Admin > Configuration > Component Setup > Related Record Setup**.
2. In the row for the appropriate component, click **Edit** from the inline **Actions** menu.
3. In the _Field Value Mappings_ section, click on the mapping you want to delete.
4. Select **Delete** in the **All** **Actions** menu.
5. Click **Continue**.

### Configuring Mappings for Related Child Record Components {#fvm-child}

* [Create one (1) or more field value mappings for related child record components][9]
* [Edit field value mappings for related child record components][10]
* [Delete field value mappings for related child record components][11]

#### Creating Field Value Mappings for Related Child Record Components {#create-fvm-child}

1. Navigate to the appropriate related child record component from the appropriate related record component.
2. Click **Add** in the _Child Object Field Mappings_ section.
3. Click **Add** in the _Field Value Mappings_ section.
4. Enter a **Label**.
5. Select a related **Child Object Field**.
6. Select a **Default Value**. This value belongs to the _Source-Child Inbound Relationship_.
7. Click **Save**.

Repeat as needed until you have the required list of field value mappings.

#### Editing Field Value Mappings for Related Child Record Components {#edit-fvm-child}

1. Navigate to the appropriate related child record component from the appropriate related record component.
2. In the _Child Object Field Mappings_ section, click on the desired mapping to view.
3. Click **Edit**.
4. Modify any of the following fields needed: **Label**, **Related Object Field**, and **Default Value**.
5. Click **Save**.

#### Deleting Field Value Mappings for Related Child Record Components {#delete-fvm-child}

1. Navigate to the appropriate related child record component from the appropriate related record component.
2. In the _Child Object Field Mappings_ section, click on the mapping you want to delete.
3. Select **Delete** in the **All Actions** menu.
4. Click **Continue**.

## Configuring the Create Related Record Action {#configure-action}

The _Create Related Record_ object action triggers Vault to generate new related records and populate them based on any mapped field values from the source record.

You must [assign](/en/lr/43127/#assign-actions) the _Create Related Record_ action as a record action on the source object to make it available to configure as a user action, entry action, and event action.

You can add the _Create Related Record_ object action as an [entry action](/en/lr/59885/#entry-actions) and a [user action](/en/lr/59885/#user-actions) on any state of any object lifecycle and nest related record creations up to a maximum of five (5) levels. When the action runs, Vault automatically creates and populates related records.

If you configure the _Create Related Record_ entry or user actions with _Related Record Setups_ without associated _Related Child Record Setups_, Vault notifies users of any failures but does not send a notification upon successful record creation. If you configure the _Create Related Record_ action with one (1) or more _Related Record Setups_ with associated _Related Child Record Setups_, a notification informs users that record creation is complete or has failed. This behavior also applies if you configure the action with multiple _Related Record Setups_ and at least one (1) has an associated _Related Child Record Setup_. For configurations with _Related Child Record Setups_, users may receive failure and success notifications later than if no _Related Child Record Setups_ are configured.

<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>: The behavior described above for success and failure notifications is dependent on enabling an optional but recommended feature available in 25R1. Contact your Veeva Representative to enable this feature.</p>
    </div>
  </div>
</div>



If you need to trigger related record creation during source record creation, configure the _Create Related Record_ object action on the _Create Record_ [event action](/en/lr/51700/) of an object lifecycle state. Entry actions and user actions cannot be used for this type of record creation. When configured as an event action, Vault notifies users immediately of any failure, but does not send a notification upon successful record creation.

You cannot configure the _Create Related Record_ action as an event action if the corresponding _Related Record Setup_ has _Related Child Record Setups_ configured.

### Recommended Configurations for the Create Related Record Action {#recommended-configurations}

For optimal performance, we recommend the following when configuring the _Create Related Record_ action:

* If you have the _Create Related Record_ action configured in your Vault, [select the _Record Migration Mode_ checkbox](/en/lr/26607/#load) to perform any bulk migration or data loading.
* If you plan to create a large number of source object records, remove the _Create Related Record_ action configuration from the _Event Actions_ section of the source object lifecycle. Additionally, if you plan to clone a Vault, we recommend you remove any event actions configured on the _User_ object through the _Vault Membership_ lifecycle.
    * If removing this configuration is not feasible, consider preventing the _Create Related Record_ action from running by configuring a condition based on record attributes (for example, a [condition](/en/lr/51700/#conditions) or [business rule](/en/lr/46866/) that restricts related record creation to records with a certain field value).
* Avoid any configuration that could trigger the _Create Related Record_ action for large volumes of records simultaneously (for example, configurations using <a class="external-link " href="https://developer.veevavault.com/sdk/" target="_blank" rel="noopener">SDK<i class="fa fa-external-link" aria-hidden="true"></i></a> or cascading state changes).

For additional help on this configuration, contact your Veeva Representative.

## Limitations {#limitations}

The following limitations affect related record automation:

* You can set up multiple related records and nest multiple levels of related record creation for an object and object type but cannot duplicate the same combination of _Source Object_, _Source Object Type_, _Related Object_, _Related Object Type_, field value mappings, and object lifecycle states.
* You cannot configure _Field Value Mappings_ and _Child Object Field Mappings_ for related records and related child records if the _Source Object_ selected has a [lookup field](/en/lr/34072/) to an object or object type.
* When editing components, you are only able to edit the _Label_ of the component.
* When deleting components, any configured entry actions associated with the deleted component will not generate a related record but will send a failure notification to users until the entry action is removed from the object lifecycle.
* _Field Value Mappings_ and _Child Object Field Mappings_ do not support inactive fields or special fields. If a field's status changes to an inactive state after you mapped it, that field's value will not populate on the generated records and is considered invalid. You must remove the field from the list of _Field Value Mappings_.
* When the _Create Related Record_ action fails, the lifecycle state of the source record will change as expected but Vault will not create any related records. Check your notification for details on the related record generation failure.
* _Related Record Setup_ components can have a maximum of three (3) _Related Child Record Setup_ components.
* Depending on configuration, each _Related Record Setup_ can have a maximum of ten (10) _Field Value Mappings_ and each _Related Child Record Setup_ can have a maximum of ten (10) _Child Object Field Mappings_.
* You can nest related record creation up to a maximum depth of five (5) related record levels.
* Vault creates a maximum of 500 related child records per job.
* The _User_ object cannot be the _Source Object_ specified on _Related Record Setups_.

## Related Permissions {#permissions}

You can complete all the steps in this article with the standard _System Administrator_ or _Vault Owner_ security profile. If your Vault uses custom security profiles, your profile must grant the following [permissions](/en/lr/22824/):

<table>
  <tr>
    <th><strong>Type</strong></th>
    <th><strong>Permission</strong></th>
    <th><strong>Controls</strong></th>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Objects: [Source Object]: Read, Create, Edit</td>
    <td>Ability to view, create, and modify Vault objects used as a source object.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Objects: [Related Object]: Read, Create, Edit</td>
    <td>Ability to view, create, and modify Vault objects used as a related object.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Pages: All Related Record Setups: View</td>
    <td>Ability to view all <em>Related Record Setup</em> pages: needed to view <em>Field Value Mapping Setup</em> and <em>Related Record Setup</em> pages.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Pages: Field Mapping: View</td>
    <td>Ability to view <em>Field Mapping</em> page within the <em>Related Child Record Setup</em> page.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Pages: Field Value Mapping Setup: View</td>
    <td>Ability to view <em>Field Value Mapping Setup</em> page.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Pages: Related Child Record Setup: View</td>
    <td>Ability to view <em>Related Child Record Setup</em> page.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Pages: Related Record Setup: View</td>
    <td>Ability to view <em>Related Record Setup</em> page.</td>
  </tr>
</table>

[1]: #configure-action
[2]: #activate-rrs
[3]: #setting-up
[4]: #configure-fvm
[5]: #permissions
[6]: #creating-fvm
[7]: #editing-fvm
[8]: #deleting-fvm
[9]: #create-fvm-child
[10]: #edit-fvm-child
[11]: #delete-fvm-child