# Setting Up Inspections (QMS)

<a href="/en/gr/78610/">QualityOne Vaults</a> allow users to process incoming, in-process, outgoing, and CoA (Certificate of Analysis) <a href="/en/gr/62019/">inspections</a> and analyze samples against pre-defined specifications.

## About the Inspections Process {#about-process}

<a href="/en/gr/515321/">Incoming, in-process, outgoing</a>, and [CoA][14] inspections provide users the ability to create sample records and analyze samples against inspection plans. Sample records run against defined sample and success criteria using a fixed number or percentage of the total evaluation method. You can configure your Vault so that users can generate and analyze inspection samples. To generate and analyze inspection samples, you must enable the proper actions in the required lifecycles, configure the appropriate page layouts to include the necessary objects, and define the _Inspection Plan_ records.

### CoA Inspections Process {#coa-process}

<a href="/en/gr/515322/">CoA inspections</a> provide users the ability to analyze single or <a href="/en/gr/69952/#multi-batch">multi-batch</a> CoA files. CoA uses an automated process to determine if the measurement values on the CoA meet specification limits. External users can contribute to the _COA Inspection_ record by directly emailing the CoA file to Vault for upload to the record when prompted by a workflow task email or by sending CoA files to a <a href="/en/gr/583672/">specified</a> Vault inbound email address.

You can configure your Vault so that users can analyze CoA files. To do so, each Vault must provide AWS Account credentials in order to leverage the Amazon Textract technology that performs an optical character recognition (OCR) scan of uploaded CoA files. When a user uploads a CoA file in an AWS supported language, Vault sends the file to AWS to extract the data, and then stores the returned data results as object records. This returned data is compared against an inspection plan which contains specification limits as inspection plan requirements; the returned data is also matched against the user's Vault language to display any <a href="/en/gr/69952/#about-multilingual-support">localized data values</a> accordingly. Vault then provides the user with a rating on whether the CoA passes or fails to meet specifications when the user runs the _Analyze COA_ action. When running _Analyze COA_, the OCR data result (extracted from AWS Textract) is stored in the CoA record for 30 days. You can optionally <a href="/en/gr/76179/#download-file">download OCR data results</a> from an analyzed CoA record to leverage the data for accuracy improvements when ingesting and analyzing various CoA formats.

<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>: <em>COA Inspections</em> are currently available only to Early Adopters. Contact your Veeva Representative for more details.</p>
    </div>
  </div>
</div>



## Configuration Overview {#overview}

Configuring your Vault to use Inspections involves the following steps:

1. [Define Application Security for _Inspection Sample Test Result_ object][1]
2. [Setup prerequisite records for Inspections][7]
3. [Configure the _Incoming_, _In-Process_ and _Outgoing Inspection_ object types][8]
4. [Configure the _COA Inspection_ object type][9]
5. [Configure the _Inspection_ lifecycles][11]
6. [Configure the _Inspection_ object actions][12]

<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>



## Defining Object Application Security {#app-sec}

To provide performance consistency for your Vault, the Inspections feature uses the <a href="/en/gr/62987/">_Raw_ object</a> data store option for the _Inspection Sample Test Result_ (`inspection_sample_test_results__v`) object. However, this data store option does not support configuring record-level security using <a href="/en/gr/33946/">DAC</a>. To secure the _Inspection Sample Test Result_ object at the record level, see <a href="/en/gr/627671/">Defining Object Application Security</a> for more details. You must also follow the conventions for raw objects when configuring this object. See <a href="/en/gr/65541/">Configuring Raw Objects</a> for more details.

## Setting Up Prerequisite Records {#setting-up}

Currently, QualityOne Inspections provides functionality to create and evaluate samples on incoming, in-process, and outgoing inspections and, for Early Adopters, to automate the inspection of CoAs. Set up the following prerequisite records to support the Inspections feature:

1. [Define all referenced items][3]
2. [Create the _Inspection Plan_ and _Inspection Plan Requirement_ records][13]

### Defining Referenced Items {#define-ref-items}

You need to populate certain picklists so you can reference picklist values when creating _Inspection Plans_ and _Inspections_. You also need to create certain records before users can create _Incoming_, _In-Process_, _Outgoing_, and _COA Inspection_ records.

You need to review and maintain values for the _Inspection Type_ <a href="/en/gr/1269/">picklist</a> so that you can reference these items when creating _Inspection Plans_.

You need to review and maintain values for the _Specification Source_ <a href="/en/gr/1269/">picklist</a> so that you can reference these items when creating _Inspection Plan Requirements_.

In order for users to be able to create _Inspection_ <a href="/en/gr/18769/">records</a>, you need to create the appropriate records for the following objects:

* For all _Inspection_ types:
    * _Material_
    * _Product (Item)_
    * _Master Specification Group_
    * _Master Specification (Item Specification)_
    * _Inspection Plan_
* For _COA Inspection_ type:
    * _Address_
    * _Characteristic_
    * _Localized Characteristic_
    * _Organization_
    * _Unit_
    * _Localized Unit_ 
    * <a href="/en/gr/76952/">_Characteristic Matching Variant_</a>
    * <a href="/en/gr/76952/">_Unit Matching Variant_</a>
    * <a href="/en/gr/76952/">_Organization Matching Variant_</a>
    * <a href="/en/gr/553553/">_Attribute Test Result Variant_</a>
    * _Below Detectable Limit Variants_
* _Purchase Order_ (for _Incoming_ and _COA Inspection_ object types only)
* _Purchase Order Line Item_ (for _Incoming_ and _COA Inspection_ object types only)
* _Production Order_ (for _In-Process_ and _Outgoing Inspection_ object types only)


<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>: In Vaults created after 22R3, the <a href="/en/gr/553553/#accept-att">acceptable attribute objects</a> are inactive in your Vault.</p>
    </div>
  </div>
</div>



For _Localized Characteristics_ and _Localized Unit_, creating appropriate records for these objects supports and maintains values for any <a href="/en/gr/69952/#about-multilingual-support">localized data records</a>.

### Creating Inspection Plans & Inspection Plan Requirements {#create-plans-reqs}

In an incoming, in-process, or outgoing inspection, _Inspection Plans_ (containing _Inspection Plan Requirements_) provide the specifications that are defined within samples which Vault compares the values in an _Inspection_ record in order to analyze whether an Inspection passes or fails.

In a CoA inspection, _Inspection Plans_ provide the specifications which Vault compares the values in an uploaded CoA file in order to analyze whether a CoA Inspection passes or fails. You can create and maintain _Inspection Plans_ for each _Material_ for products.

You can define the specifications of an _Inspection Plan_ in one of the following ways: 

* [Define referenced records][3] to use for a new _Inspection Plan_ record.
* Deep copy an existing _Inspection Plan_ and its associated referenced records using the <a href="/en/gr/32218/">_Copy Record_ action</a>: _Inspection Plan Requirement_ and _Acceptable Attribute_ records. 
  * To acquire and maintain a copy of the same _Inspection Plan_ and its specifications, navigate to the appropriate _Inspection Plan_ record and select the **Copy Record** action from the **All Actions** menu. In the pop-up dialog, select the **Copy Related Records** checkbox to copy the hierarchy of records identified. Click **Save** to complete the action. You can start modifying the new records to your requirements.

To create a new _Inspection Plan_:

1. Navigate to **Business Admin > Objects > Inspection Plans**.
2. Click **Create**.
3. Enter a name for the **Inspection Plan**.
4. Select a **Material**.
5. Select a **Specific Product** (_Product Version_).
6. Optional: Enter a **Description**.
7. Optional: Select a **Facility**.
8. Optional: Select a **Location**.
9. Optional: Select the **Inspection Type**.
10. Click **Save**. To create another _Inspection Plan_, click **Save + Create**.

If you have already created _Master Specification_ and associated with a _Master Specification Group_ for a _Specific Product_, Vault will automatically generate an _Inspection Plan Requirement_ upon saving the _Master Specification_.

To create an _Inspection Plan Requirement_ by creating a _Master Specification_:

1. Navigate to the appropriate _Inspection Plan_.
2. In the _Inspection Plan Requirements_ section, click **Create**.
3. Select whether the inspection plan requirement type is a **Variable Specification** or **Attribute Specification**. Variable specifications allow you to specify lower and upper limits while attribute specifications are based on a single attribute value.
  * For _COA Inspections_, ensure you create the appropriate <a href="/en/gr/553553/">_Attribute Test Result Variant_</a> or <a href="/en/gr/553553/#accept-att">_Acceptable Attribute_</a> records, depending on how you've configured your Vault to match field values in CoA files.
4. Click **Continue**.
5. Select a **Characteristic**.
6. Optional: Select **CTQ?** if this requirement is a Critical to Quality parameter.
7. Optional (Variable type only): Enter the lower specification limit (**LSL**).
8. Optional (Variable type only): Enter the upper specification limit (**USL**).
9.  Optional (Variable type only): Select the measurement **Unit** or create a new unit.
10. Optional: Enter the **Target Value**.
11. Select the **Specification Source**.
12. Click **Save**. To create another inspection plan requirement, click **Save + Create**.

<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>: Vaults using the legacy data model (prior to the 21R2 release) use <em>Item Specification</em> instead of <em>Master Specification</em>.</p>
    </div>
  </div>
</div>



## Configuring Incoming, In-Process & Outgoing Inspections {#config-inspections}

To configure your Vault to create and evaluate incoming, in-process, and outgoing inspections, see <a href="/en/gr/69950/">Configuring Incoming, In-Process & Outgoing Inspections</a> for more details.

## Configuring CoA Inspections {#config-coa-inspections}

To configure your Vault to create and analyze CoA inspections, see <a href="/en/gr/69952/">Configuring CoA Inspections</a> for more details.

<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>: This feature is currently available only to Early Adopters. Contact your Veeva Representative for more details.</p>
    </div>
  </div>
</div>



## Inspections Lifecycles {#lifecycles}

QualityOne Inspections contains various <a href="/en/gr/29798/">object lifecycles</a> which your organization can use and customize to suit your specific needs:

* _Inspection_
* _Inspection Plan Lifecycle_
* _Inspection Sample Lifecycle_
* _Inspection Sample Test Result_
* _Master Specification Lifecycle_

<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>: Vaults using the legacy data model (prior to the 21R2 release) use <em>Item Specification</em> lifecycle and <em>Item Version</em> lifecycle instead of <em>Master Specification Lifecycle</em>.</p>
    </div>
  </div>
</div>



QualityOne Inspections contains the following <a href="/en/gr/2434/">document lifecycle</a> which your organization can use and customize to suit your specific needs:

* _COA Document_ lifecycle

## Configuring Object Actions {#actions}

The _Inspection_ object lifecycle contains the following actions shared between all _Inspection_ types:

* _Analyze Inspection_
* _Delete Inspection_
* _Sync Related Records_

See <a href="/en/gr/69950/#actions">Configuring Incoming, In-Process & Outgoing Inspections</a> and <a href="/en/gr/69952/#config-coa-actions">Configuring CoA Inspections</a> for more details.

## About Inspection Field Sync Tracking {#tracking}

Inspections tracks and stores data records when users modify and save changes to specific related fields in existing _Inspection_ records, triggering the asynchronous _Sync values from related records_ job. This job copies those modified field values in the _Inspection_ record to the related fields in the _Inspection Sample Test Result_ records. When the job runs, Vault creates an _App field sync tracker_ record for each _Inspection_ record that details whether the job was successful in syncing the field values or not. Should synchronization fail, you can use this data record for investigation.

Upon completion, users receive a Vault notification if the job failed due to errors. When this happens, users should run the _Sync Related Record_ action on the same <a href="/en/gr/69950/#actions">_Incoming, In-Process, Outgoing_</a>, or _<a href="/en/gr/69952/#configuring_coa_object_actions">COA</a> Inspection_ record to manually update the related _Inspection Sample Test Result_ records.

Users trigger the _Sync values from related records_ job when they modify and save the following fields on _Inspection_ records:

* _Material_ (`material__v`)
* _Supplier Name_ (`supplier_name__v`)
* _Supplier Manufacturing Site Name_ (`supplier_manufacturing_site_name__v`)
* _Facility_ (`facility__v`)

[1]: #app-sec
[3]: #define-ref-items
[4]: #osr-comp
[5]: #rmc-comp
[6]: #rmr-obj
[7]: #setting-up
[8]: #config-inspections
[9]: #config-coa-inspections
[11]: #lifecycles
[12]: #actions
[13]: #create-plans-reqs
[14]: #coa-process
[15]: #core-obj