**Source URL:** https://lims.veevavault.help/en/lr/15333/

# Working With Retains Tests

Retains Testing involves testing *Samples* from a specific production batch that were set aside and stored for later analysis. These *Samples* may be used to investigate future issues such as quality concerns, customer complaints, or regulatory questions. In some cases, such as under Food and Drug Administration Regulation 21 CFR 211.170 in the United States, setting aside samples for Retains Testing may be mandated by law.

If configured by an Admin, you can define and perform Retains Testing either as part of a predetermined schedule, or on an ad hoc basis.

## Defining Retains Tests

A design data Admin can define Retains Tests to be performed by Analysts.

To define Retains Tests, perform the following additional steps during Spec Data creation:

1. When viewing a *Batch Release Spec Data* in the Spec Data Builder, you can select **Mark Retains** to mark a sample as intended for Retains Testing. You can only mark one sample per *Sample Definition* as the *Retains Sample*. This establishes the Retains path, which can include any number of sample actions.
2. If not already defined, you can enter the **Retains Testing Frequency** and **Retains Testing Unit** in the resulting prompt. These fields are used to populate the *Next Retains Testing Date* for *Retains Samples*. You can edit them later by selecting the **Edit Spec Data** pencil icon in the Spec Data Builder.

## Performing Retains Testing

In order to begin a Retains Test:

1. On the *Release Lab Sample* record details page for the sample to undergo retains testing, select **Actions > Initiate Retains Testing**.
2. The resulting dialog includes the following fields:
    1. *Scheduled*
    2. *Pulled Date*: This field is required and autopopulates with the current date.
    3. *Next Retains Pull Date*: This field is required and autopopulates with the current date + the frequency selected. For example, A test with a *Pulled Date* of July 22, a *Retains Testing Frequency* of *1*, and a *Retains Testing Unit* of *months* would have a *Next Retains Pull Date* of August 22. If either the *Retains Testing Frequency* or the *Retains Testing Unit* is blank, this field also remains blank.
    4. *Override Next Retains Pull Date*: This field defaults to *False*.
    5. *Location*
    6. *Quantity Pulled*
    7. *Unit of Measure*
    8. *Comments*: Depending on your configuration, this field may be required.
3. Click **Save**.

### About the Retain Inventory

The *Retain Inventory* and *Retain Inventory Summary* track the quantity of samples from a given batch that have been marked for Retains Testing as they move in and out of storage. These records are automatically created when a *Lab Sample* record is created or updated such that *Retains Testing* (`retains_testing__v`) = Yes. Each *Retains Sample* in a given batch has its own *Retain Inventory*.

They track the following fields:

* *Quantity Stored*
* *Quantity Pulled*
* *Quantity Remaining*
* *Quantity Disposed*

The below table explains how each of the fields is calculated:

|Object|Field|How it is Populated|How it is Updated|
|--- |--- |--- |--- |
|*Inventory*|*Quantity Stored*|Current value + *Release Lab Sample.Quantity*|When the *Quantity* (`amount__v`) field is populated or updated on the *Release Lab Sample* (when updated, the calculation needs to adjusted based on the different between the previous and new value)|
|*Inventory*|*Quantity Pulled*|Current value + *Retain Lab Sample.Quantity*|When the *Quantity* (`amount__v`) field is populated or updated on a *Retain Lab Sample* related *Lab Sample* (when updated, the calculation needs to adjust based on the difference between the previous and new value)|
|*Inventory*|*Quantity Pulled*|Current value - *Retain Lab Sample.Quantity Stored*|When the *Quantity Stored* (`quantity_stored__v`) field is populated or updated on a *Retain Lab Sample* (when updated, the calculation needs to adjusted based on the different between the previous & new value)|
|*Inventory*|*Quantity Remaining*|*Quantity Stored* - *Quantity Pulled* - *Quantity Disposed*|When any of the 3 field values are updated|
|*Inventory*|*Quantity Disposed*|Manual entry|Manual entry|
|*Inventory Summary*|*Quantity Pulled*|Sum of *Quantity Pulled* across all related *Inventory* records|When the *Quantity Pulled* is updated on any of the related *Inventory* records|
|*Inventory Summary*|*Quantity Stored*|Sum of *Quantity Stored* across all related *Inventory* records|When the *Quantity Stored* is updated on any of the related *Inventory* records|
|*Inventory Summary*|*Quantity Remaining*|Sum of *Quantity Remaining* across all related *Inventory* records|When any of the 3 field values are updated on any of the related *Inventory* records|
|*Inventory Summary*|*Quantity Disposed*|Sum of *Quantity Disposed* across all related *Inventory* records|When the *Quantity Disposed* is updated on any of the related *Inventory* records|