# Automatic Record Creation in RIM Vaults

RIM Vaults include several [Vault Java SDK record triggers](/en/lr/45776/#record-triggers) that can create or update object records automatically in certain situations. Automatic record creation ensures that data is more accurate while helping to save time when users create and update records.

Some RIM Vault Java SDK record triggers are enabled by default, and some must be enabled by an Admin. You can enable or disable these from the [**Admin > Settings > Application Settings** page](/en/lr/53688/).

## Automatic Creation of Application Country Records

Setting the **Automatic creation of Application Country records** checkbox enables Vault to automatically create _Application Country_ join records when users create or update an _Application_ record. Vault automatically creates an _Application Country_ record based on the selected _Lead Market_ country on the _Application_. If [system-managed naming](/en/lr/30986/) is not enabled on the _Application Country_ object, Vault names records based on the name of the related _Country_ record.

When enabling this setting, we recommend [disabling hierarchical copy](/en/lr/28740/#create_relationships) on the _Application Country_ parent object field _Application_ to prevent duplicate record creation.

Record creation behavior varies slightly in the following situations:

  * If an _Application Country_ record already exists with the same country as the selected _Lead Market_, Vault does not create a duplicate record.
  * For EU applications with the Mutual Recognition Procedure type and GCC applications with the GCC Procedure type, Vault creates a common _Application Country_ record in addition to the country-specific join records. To create the new records, Vault references the _RIM UUID_ values within existing "Common (EU)" and "Common (GCC)" _Country_ records.

  * When a user updates the _Lead Market_ on an existing _Application_ record, Vault creates a new _Application Country_ record but does not delete the original _Application Country_ record.

If Vault cannot create _Application Country_ join records, the user who created the _Application_ record receives a failure notification. Vault still creates the new parent _Application_ records.

## Automatic Creation of Submission Country Records

Setting the **Automatic creation of Submission Country records** checkbox enables Vault to automatically create _Submission Country_ join records when users create a _Submission_ record. Vault automatically creates a _Submission Country_ record based on the application's _Lead Market_ country or any _Application Country_ records that already exist. If system-managed naming is not enabled on the _Submission Country_ object, Vault names records based on the name of the related _Country_ record.

When enabling this setting, we recommend [disabling hierarchical copy](/en/lr/28740/#create_relationships) on the _Submission Country_ parent object field _Submission_ to prevent duplicate record creation.

If Vault cannot create _Submission Country_ join records, the user who created the _Submission_ record receives a failure notification. Vault still creates the new parent _Submission_ records.

<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>: We recommend enabling the automatic creation of <em>Submission Country</em> records in conjunction with the automatic creation of <em>Application Country</em> records. This will ensure data validity and integrity between the countries on the <em>Application</em> record and the countries on its child <em>Submission</em> records.</p>
    </div>
  </div>
</div>



## Automatic Creation of Submission Language Join Records {#submission-language}

Setting the **Automatic creation of Submission Language records** checkbox enables Vault to automatically create _Submission Language_ join records when users create new _Submission Country_ records. Vault creates one (1) _Submission Language_ record for every language available for the _Submission Country_, based on the related _Country Language_ record.

When enabling this setting, we recommend [disabling hierarchical copy](/en/lr/28740/#create_relationships) on the _Submission Language_ parent object field _Submission_ to prevent duplicate record creation.

Record creation varies in the following situations:

* If multiple _Country Language_ records exist for a country, Vault creates _Submission Language_ join records for all of the country's languages. For example, if the country is Jordan, Vault will create two (2) _Submission Language_ records for Arabic and English.
* If a _Submission Language_ record already exists for that country and language, Vault does not create a duplicate record.
* If there is no related _Country Language_ record for any country on the _Submission Country_ record, Vault does not create a _Submission Language_ record for that country.

If record creation fails for any of the _Submission Language_ join records, Vault still creates the new _Submission Country_ record.

You cannot enable this checkbox without first enabling the **Automatic creation of Submission Country records** checkbox. When you enable this checkbox, the _Country_ field on the _Submission Language_ object becomes a required field.

## Automatic Creation of Product Family Join Records {#product-family-joins}

Setting the **Automatic creation of Product Family join records** checkbox enables Vault to automatically create join records when users populate the _Primary Product Family_ (`product__v`) field while creating or updating object records for the objects in the table below.

If users change the value in the _Primary Product Family_ field on existing records, Vault creates new join records but does not delete existing ones. Vault creates the new source object records even if record creation fails for _Product Family_ join records.

| Source Object Record | Join Object Record Created |
|---|---|
| Application | Product Family Application |
| Clinical Study | Product Family Clinical Study |
| Nonclinical Study | Product Family Nonclinical Study |
| Active Substance | Product Family Active Substance |
| Product (`drug_product__v`) | Product Family Product (`product_pharmaceutical_product__rim`) |

<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>: To prevent Vault from creating duplicate records, <em>Product Family Clinical Study</em> records are not created when the <em>Primary Product Family</em> field is populated on a <em>Clinical Study</em> record, and the study has the <em>Link</em> field populated. This is because a <em>Link</em> field value indicates that the <em>Clinical Study</em> record was itself created via an automatic process that may also create <em>Product Family Clinical Study</em> records, for example by the RIM-Clinical Operations Vault Connection.</p>
    </div>
  </div>
</div>



## Automatic Creation of Commitment Application Join Records {#commitment-application}

Setting the **Automatic creation of Commitment Application records** checkbox enables Vault to automatically create _Commitment Application_ records when users populate the _Related Application_ field while creating or updating _Commitment_ records. If system-managed naming is not enabled on the _Commitment Application_ object, Vault names records based on the IDs of the _Commitment_ and _Application_ records.

Vault does not delete _Commitment Application_ join records when users clear or update the _Related Application_ field on existing records. If record creation fails for the _Commitment Application_ join record, Vault still creates or updates the new _Commitment_ record.

## Automatic Sequence ID Generation & Update {#sequence-id}

Setting the **Automate the Sequence ID creation** checkbox enables Vault to automatically calculate the value in the _Sequence ID_ (`xml_submission_id__v`) field when users create a new _Submission_ record. Vault generates the new values sequentially. For example, if your Vault includes submissions with the *Sequence ID*s 0001, 0002, 0004, and 0005, the next _Sequence ID_ that Vault generates will be 0006.

Vault can automatically determine the next available sequence number and update the field when:

* The _Sequence ID_ field is active on the current _Submission_ object type
* The _Sequence ID_ field is blank
* The _XML ICH DTD / XSD Version_ field is set to _ICH 3.2_

If the _Sequence ID_ field is blank on an existing _Submission_ record, Vault also generates and populates the _Sequence ID_ when a user updates the _XML ICH DTD / XSD Version_ field to _ICH 3.2_.

When the _Sequence ID_ field is updated on an existing _Submission_ record with continuous publishing enabled, Vault republishes all necessary components to maintain a valid XML.

You can use the _Automate the Sequence ID_ action to specify when and on what Application Types/Submission Types the _Sequence ID_ field is auto-populated. For example:

* Entry Action on Submission Lifecycle In Progress state: Sequence ID will only be populated when Submission record advances to In Progress

<a href="https://platform.veevavault.help/assets/images/24r1.2-sequence-ID.png" data-lightbox="images" data-title="" data-alt="Sequence ID">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/24r1.2-sequence-ID.png" alt="Sequence ID" style="max-width: 100%;width: 400px;"  />
</a>

For RIM-PromoMats Connection customers, the Automate the Sequence ID action must be executed upon record creation:
* Event Action: Update record upon Create

<a href="https://platform.veevavault.help/assets/images/24r1.2-automate-sequence-id.png" data-lightbox="images" data-title="" data-alt="Automate Sequence ID">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/24r1.2-automate-sequence-id.png" alt="Automate Sequence ID" style="max-width: 100%;width: 400px;"  />
</a>

Submissions Publishing customers should ensure the _Automate the Sequence ID_ action is configured to occur before any action that automatically enables Continuous Publishing to prevent failure of the Publishing job to initiate.
## Automatic Record Creation in RIM Registrations

Some Vault Java SDK Triggers in RIM Registrations Vaults are enabled automatically, but an Admin can temporarily disable them to allow for smoother data migration. See [Pausing Vault Java SDK Record Triggers in RIM Registrations](/en/lr/64586/) for details about these triggers and how to pause them.
