# Configuring Automatic Quantitative Assessments (Compliance Management)

[Compliance Management ](/en/lr/71434/) provides users with the ability to [automatically create _Quantitative Assessment_ records](/en/lr/615756/#automatic) for substances of concern by determining if concentrations of restricted substances in the formula are within acceptable limits. Vault allows users to quickly determine whether a formula is compliant in specified local markets based on pre-defined mappings, allowing users to derisk product launches by assessing the right-to-sell in certain markets before initiating testing and commercialization.

You must complete all required steps in [Configuring Quantitative Assessments](/en/lr/615757/) before completing the steps in this article.

## About Automatic Quantitative Assessments {#about}

Compliance Management Vaults include the [_Create Quantitative Assessments_ action][5] on the _Formulation_ object, which identifies any _Substances_ in the related _Formulation Concentrations_ that match the _Substances_ in existing _Regulatory Restrictions_, including which of the substance's concentrations exceeds the maximum allowable limit for the _Formula's_ intended use case. When users run the _Create Quantitative Assessments_ action on a _Formulation_ record, Vault suggests the applicable _Quantitative Assessments_ for these substances of concern based on your [pre-defined units of measure mappings][4], which allow you to define how Vault compares different units of measure. Users can then review the potential _Quantitative Assessments_ and specify which records they want to create. When the action completes, Vault inactivates any existing _Quantitative Assessments_ with the same _Regulatory Restriction_ and _Formulation Concentration_ values as the newly generated records.

For all _Substances_ in the _Formula's_ related _Formulation Concentrations_, Vault suggests potential _Quantitative Assessments_ for _Substances_ with active _Regulatory Restrictions_ that meet the following criteria:

* The _Amount_ field is populated. 
* The _Restriction Type_ is "Max". 
* The _Unit_ maps to a corresponding value on the _Formulation Concentration_ in either of the following ways:
  * The _Unit_ value equals the _Concentration Unit_ value of the _Formulation Concentration_.
  * An active [Object Field Picklist Entry Mapping][4] maps the _Unit_ value to a custom unit of measure field on the _Formulation Concentration_.

If Vault finds multiple _Regulatory Restrictions_ for the same _Substance_ for different units of measure, the action only considers the most recently created _Regulatory Restriction_.

## Configuration Overview {#overivew}

Configuring your Vault to use Quantitative Assessments involves the following steps:

1. [Configure object fields][1]
2. [Map units of measure][4]
3. [Configure the _Create Quantitative Assessments_ action][5]
4. [Configure user permissions][6]

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



## Configuring Object Fields {#object-fields}

You must configure object fields on the _Quantitative Assessment_ and _Formulation Concentration_ objects to support the automatic creation of _Quantitative Assessments_.

### Quantitative Assessment {#qa}

Ensure that the _Name_ field on the _Quantitative Assessment_ object is [system-managed](/en/lr/30986/).

### Formulation Concentration {#fc}

You must add the appropriate [custom fields](/en/lr/15057/#how_to_add_object_fields) for units of measure to the _Formulation Concentration_ object. These fields must be a Number type or Formula type that returns a numeric value. You can map these fields to the corresponding values in the [_Unit_ picklist](/en/lr/615757/#picklists). 

## Mapping Units of Measure {#map}

You can configure your Vault to compare different units of measure using Object Field Picklist Entry Mapping components to map the custom fields for units of measure on the [_Formulation Concentration_][3] object to the applicable values in the _Unit_ picklist used in _Regulatory Restriction_ records. Vault references these mappings when users run the _Create Quantitative Assessments_ action and suggests potential _Quantitative Assessments_ to create for all Substances for which applicable _Regulatory Restrictions_ exist. For example, if your _Formulation Concentrations_ specify Dioxane concentration in weight percentage (wt%) and your _Regulatory Restrictions_ specify Dioxane units in parts per billion (ppb), you can map  wt% to ppb so that Vault can easily compare a _Formula's_ Dioxane concentration to restrictions and identify which _Quantitative Assessments_ to create for all applicable _Regulated Categories_.

 <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>: You can also use <a class="external-link " href="https://developer.veevavault.com/mdl/#mdl-overview" target="_blank" rel="noopener">MDL<i class="fa fa-external-link" aria-hidden="true"></i></a> to create Object Field Picklist Entry Mapping components.</p>
    </div>
  </div>
</div>



To map concentration units of measure:

1. Navigate to **Admin > Configuration > Object Field Picklist Entry Mapping**.
2. Enter a unique **Name** for the mapping you are creating, such as `wt_percent_ppb`.
3. For **Object**, select **Formulation Concentration**.
4. For **Field**, enter the name of the [custom field on the _Formulation Concentration_ object][3] you are mapping in "Field.[field_name__c]" format. For example, `Field.wt_percent__c`.
5. Enter a unique **Label** for the mapping you are creating, such as "Wt Percent PPB".
6. For **Picklist**, select **Unit**.
7. For **Picklist Entry**, enter the name of the _Unit_ picklist value you are mapping to in "Picklistentry.[picklistentry_name__c]" format. For example, `Picklistentry.ppb__c`.
8. Specify if the Object Field Picklist Entry Mapping is **Active**. If you select **No**, Vault ignores the inactive mapping.
9. Click **Save**.

Object Field Picklist Entry Mappings must be unique. You cannot create multiple mappings for the same field and picklist entry combination.

## Configuring the Create Quantitative Assessments Action {#action}

You must configure the _Create Quantitative Assessments_ user action on the _Formulation_ object to allow users to create _Quantitative Assessments_ automatically. When users run the action on a _Formula_ type of _Formulation_ record, they can review a list of potential _Quantitative Assessments_ for substances of concern on the _Select the Quantitative Assessment records to create_ page before selecting which records to create.

### About the Create Quantitative Assessments Action {#action-about}

Vault populates some fields on potential _Quantitative Assessments_ depending on whether a value on a _Formulation Concentration_ record is equal to the value on the applicable _Regulatory Restriction_ record. If the values are equal, Vault uses the corresponding value. If the values are not equal and an active [Object Field Picklist Entry Mapping][4] component maps the unit values, Vault uses the mapped value.

Vault populates _Quantitative Assessment_ fields as follows:

* **Formulation Concentration**: Depending on value mapping:
  * Equal unit values: The _Formulation Concentration_ record's _Total Concentration_ field value.
  * Mapped unit values: The _Formulation Concentration_ record's [mapped][4] field value.
* **Formula Unit**: Depending on value mapping:
  * Equal values: The _Formulation Concentration_ record's _Concentration Unit_ field value.
  * Mapped values: _Formulation Concentration_ record's [mapped][4] _Unit_ picklist value.
* **Regulated Category**: The _Regulatory Restriction_ record's _Regulated Category_ field value.
* **Location**: The _Regulated Category_ record's _Location_ field value.
* **Intended Use**: The _Regulatory Restriction_ record's _Intended Use_ field value.
* **Restriction Amount**: The _Regulatory Restriction_ record's _Amount_ field value.
* **Restriction Unit**: The _Regulatory Restriction_ record's _Unit_ field value.
* **Converted Concentration**: Depending on value mapping:
  * Equal unit values: The _Formulation Concentration_ record's _Total Concentration_ field value.
  * Mapped unit values: The _Formulation Concentration_ record's [mapped][4] field value.
* **Assessment Status**: Depending on concentration amounts:
  * If the _Formulation Concentration_ is less than or equal to the _Restriction Amount_: **Y**
  * If the _Formulation Concentration_ is more than the _Restriction Amount_: **N**

The _Create Quantitative Assessments_ action will fail for the following reasons:

* No mappings exist for the applicable units of measure and the corresponding record values are not equal.
* You have configured a lifecycle on the _Quantitative Assessment_ object. 
* Any applicable _Regulated Restrictions_ have a _Type_ that is not "Max".
* The relevant data on the applicable _Formulation_, _Formulation Concentration_, or _Regulatory Restriction_ records change after a user runs the action and before the job completes.
* Any _Substance_ appears more than once in the _Formulation_.

### How to Configure the Create Quantitative Assessments Action {#action-how}

To configure the _Create Quantitative Assessments_ user action, [assign](/en/lr/43127/#assign-actions) the action to the _Formulation_ object and do one (1) of the following:

* Select the **Available in All Lifecycle States** checkbox to apply [atomic action security](/en/lr/47850/#Atomic_Security_Actions) defaults for the applicable lifecycle states.
* Add the action as a [user action](/en/lr/59885/#user-actions) to the applicable states of the _Formulation_ object 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>: Do not configure a lifecycle on the <em>Quantitative Assessment</em> object. The <em>Create Quantitative Assessments</em> action will fail if you use a lifecycle on the <em>Quantitative Assessment</em> object.</p>
    </div>
  </div>
</div>



## Configuring User Permissions {#user-permissions}

You must ensure users have the appropriate read and create [permissions](/en/lr/22824/) to access the appropriate objects and object fields in addition to the permissions outlined below:

* For the _Formulation Concentration_ object: _View_ permission and _Read_ permission on the following fields:
  * _Concentration Unit_
  * _Formula_
  * _Substance_
  * _Total Concentration_
  * Any [mapped units of measure fields][4]
* For the _Quantitative Assessment_ object: _Create_ permission and _Read_ permission on the following fields: 
  * _Assessment Status_
  * _Converted Concentration_
  * _Formula Concentration_
  * _Formula Unit_
  * _Intended Use_
  * _Regulated Category_
  * _Restriction Amount_
  * _Restriction Unit_
  * _Status Icon_
  * _Substance_
* For the _Regulated Category_ object: _View_ permission and _Read_ permission on the _Location_ field. 
* For the _Regulatory Restriction_ object: _View_ permission and _Read_ permission on the following fields: 
  * _Amount_
  * _Intended Use_
  * _Regulated Category_
  * _Restriction Type_
  * _Substance_
  * _Unit_
* _Pages: All Pages: Automate Quantitative Assessments Page_.

## Related Permissions {#related-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>Admin: Configuration: Objects: Create, Edit</td>
    <td>Ability to create and modify Vault objects and Object Field Picklist Entry Mapping components.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Admin: Configuration: Picklists: Edit</td>
    <td>Ability to create and modify Vault objects.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Admin: Security: Permission Sets: Edit</td>
    <td>Ability to view and use the <em>Loader</em> tab.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Application: Vault Actions: API: Metadata API</td>
    <td>Ability to access the <em>Object Field Picklist Entry Mapping</em> page from the <em>Application Configurations</em> section of the <strong>Admin > Configurations</strong> page.</td>
  </tr>
</table>

[1]: #object-fields
[2]: #qa
[3]: #fc
[4]: #map
[5]: #action
[6]: #user-permissions