# Configuring the Formulation Composition Viewer (Compliance Management)

[Compliance Management](/en/lr/71434/) provides the [Formulation Composition Viewer](/en/lr/74432/), which allows users to easily visualize a formula's hierarchical composition in relation to its formulation data, including all compositional components. Users can quickly check if the chemical or packaging components meet regulatory requirements. Users can ensure that the formula is compliant by reviewing compliance data in the viewer, including _Qualitative Assessments_ generated from [formulation questionnaire responses](/en/lr/492019/), before approving it for use by your organization. 

<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 use this feature, each raw material in the applicable <em>Formulation</em> can be associated with no more than one (1) supplier. This allows regulatory teams to assess each material in terms of a specific supplier and account for variations such as impurity profiles and total concentrations of constituents.</p>
    </div>
  </div>
</div>



Users can access the viewer on _Formulation_ and _Packaging Component_ types of _Formulations_. The viewer displays all relevant child _Formulations_ based on the child _Formulation Compositions_ of the parent _Formulation_. From within the viewer, users can view, create, and open active _Qualitative Assessments_ for each listed _Formulation_ and _Regulated Category_. You can configure the viewer to enable users to create up to 15 _Qualitative Assessments_ in bulk.

<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 prior to 22R3, the <em>Qualitative Assessment</em> object may be labeled <em>Compliance Assessment</em>.</p>
    </div>
  </div>
</div>



## About the Formulation Composition Viewer {#about}

You can configure the viewer to display _Regulated Category_ object field columns, allowing users to view, create, and open _Qualitative Assessments_ directly in the viewer. This also allows users to populate the _Compliance Assessment Status_ field directly in the viewer. You can specify an additional secondary field that users can populate in the viewer. 

### About Bulk Create {#bulk}

You can enable bulk create on the viewer, allowing users to create up to 15 _Qualitative Assessments_ at a time for a _Formulation_ from directly in the viewer. When they click the _Manage Qualitative Assessments_ icon for a _Formulation_ in the viewer, the _Manage Qualitative Assessments for [Formulation Title]_ dialog appears. The dialog includes the _Qualitative Assessment Status_ field and, when applicable, the secondary field you configure to appear in the dialog. If any _Qualitative Assessments_ already exist for that _Formulation_, those values are pre-populated in the dialog. If you've configured [default values](/en/lr/42778/) for either field, Vault populates those for users to review in the dialog.

Users can populate and update values in the dialog. If they change values for any existing _Qualitative Assessments_, Vault inactivates the existing record and replaces it with a new record with the values specified by the user.

## Configuration Overview {#overview}

Configuring your Vault to use the Formulation Composition Viewer involves the following steps:

1. [Map regulated categories][8]
2. [Configure assessment statuses][9]
3. [Configure the _Formulation_ object layout][5]
5. [Configure the _Qualitative Assessment_ object layout][4]
6. [Configure _Formulation Composition_ object layout][12]
7. [Define referenced items][15]
8. [Configure user permissions][7]

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



## Mapping Regulated Categories {#map}

The viewer only displays data from _Qualitative Assessments_ with _Regulated Category (Internal Name)_ values. These values represent internal names your organization uses for regulated categories such as "TSCA" for the "Toxic Substance Control Act" _Regulated Category_. The viewer uses these internal names as column headers on the right side of the grid.

You must create internal names and map them to _Regulated Categories_ so that the viewer displays relevant _Qualitative Assessments_. When users select a _Regulated Category_ on a _Qualitative Assessment_ record, Vault populates the _Regulated Category (Internal Name)_ field based on your mappings. Vault does not allow users to create _Qualitative Assessments_ for unmapped _Regulated Categories_.

To map _Regulated Categories_ to internal names:

1. Add appropriate values to the _Regulated Category (Internal Name)_ [picklist](/en/lr/1269/) for all _Regulated Categories_.
2. _Add the Regulated Category (Internal Name)_ field to the _Regulated Category_ [object layout](/en/lr/26387/).
3. Populate the _Regulated Category (Internal Name)_ field on all _Regulated Categories_ in your Vault.

You cannot edit any picklist values that are currently referenced in any _Qualitative Assessment_ records.

## Configuring Assessment Statuses {#status}

The viewer displays the status value of active _Qualitative Assessments_ related to the _Formulation_. When users create _Qualitative Assessments_, they must select a status value from the _Compliance Assessment Status_ picklist. When Vault generates _Qualitative Assessments_ from [imported formulation questionnaire data](/en/lr/492101/#import), it assigns _Compliance Assessment Status_ based on your [pre-defined mappings](/en/lr/492019/#map).

### Adding Values to Picklists {#picklists}

You must [add values to the following picklists](/en/lr/1269/):

* **Compliance Assessment Status**: This picklist contains the status values users can assign to _Qualitative Assessments_. We recommend adding the values "Y", "N", "E", "R", and "N/A".
* **Assessment Status Color**: This picklist contains the colors that users can select to specify how _Compliance Assessment Status_ picklist values appear in the Formulation Composition Viewer. See [Configuring the Assessment Status Color Picklist][2] 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>: These picklists also display statuses in the <a href="/en/lr/713529/#picklists">Packaging Composition Viewer</a>.</p>
    </div>
  </div>
</div>



#### Configuring the Assessment Status Color Picklist {#color-picklist}

You can configure the _Assessment Status Color_ picklist to allow users to select specific colors to display _Compliance Assessment Status_ values in the viewer. This allows users to draw special attention to a specific record's compliance status for a certain category and alert all users of that status. We recommend configuring only a small number of colors to maximize the visual impact of colors displayed in the viewer and help direct user attention to specific statuses.

1. Navigate to **Business Admin > Picklists > Assessment Status Color**.
2. Click **Edit**.
3. In the _Picklist values_ section, type a new color value such as "Red" and press **Enter** on your keyboard to add the new _Picklist Value Label_. The new value also populates the _Picklist Value Name_ field for the new color.
4. In the **Picklist Value Name** field for the new color value, replace the populated color value with a six (6) digit hex color code such as "ff0000" for the color red. If you enter an invalid hex color code and a user selects that picklist value on a record, Vault displays that _Compliance Assessment Status_ value in Vault's default hyperlink color.
5. Optional: Add additional colors to the picklist.
6. Click **Save**.

Vault displays the _Compliance Assessment Status_ in the selected color in the viewer for all users. If the _Assessment Status Color_ field is blank, Vault displays that status in Vault's default hyperlink color for all users.

## Configuring the Qualitative Assessment Object Layout {#ca-page-layout}

You must add the _Compliance Assessment Status_ and _Assessment Status Color_ fields to the _Qualitative Assessment_ [object layout](/en/lr/26387/) so that users can select a status and color that determines how Vault displays the _Compliance Assessment Status_ value in the viewer.

You must also add the _Regulated Category (Internal Name)_ field to the _Qualitative Assessment_ object layout. Vault populates this field based on [regulated category mapping][8].

## Configuring the Formulation Object Layout {#formulation-page-layout}

You must update the _Formulation_ object layout so that users can see the viewer, specify type, and add the appropriate child and parent records.

### Inserting the Formulation Composition Viewer Section {#viewer}

You must insert the _Formulation Composition Viewer_ section to the _Formulation_ [object layout](/en/lr/26387/) so that users see the viewer on a _Formulation_ record's detail page. 

To insert the viewer section:

1. Navigate to **Admin > Configuration > Objects > Formulation > Layouts > [Layout]**.
2. Insert the **Formulation Composition Viewer** control section with the slider (<img class="inline" src="https://platform.veevavault.help/assets/images/CPC-Icon-Slider.png" alt="Slider Icon" style="" />) icon.
3. Optional: Enter a **Section Label**.
4. Optional: Enter a **Section Name**.
5. Optional: In the **Show the section only in these lifecycle states** field, select one (1) or more lifecycle states. This option only appears if the object uses a [lifecycle](/en/lr/30683/).
6. Optional: Enter **Section Help** that users will see on _Formulation_ object records.
7. Optional: Select the **Expand the section by default** checkbox so that the section is always open when users open _Formulation_ object records.
8. Optional: Select the **Shade hierarchical levels** checkbox to help users distinguish hierarchical levels when they open the viewer.
9. Optional: Select the **Highlight row on hover** checkbox to help users distinguish the relevant column values for a _Formulation_ when they hover on a specific row.
10. Optional: For **Grid Columns (Formulation Compositions)**, select up to 20 _Formulation Composition_ fields to display on the left side of the grid. The _Formulation Name_ field must be the first column. This side of the grid only [supports certain fields][6]. Drag and drop the fields to determine the order the columns display to users.
11. Optional: For **Freeze Grid Columns (Formulation Compositions)**, select how many columns to display on the left side of the grid while users scroll horizontally based on the order you arranged the fields. Drag and drop the fields to determine the order the columns display to users.
12. Optional: For **Grid Columns (Regulated Categories)**, select up to 15 _Regulated Categories_ to display as headers on the right side of the grid. The viewer will display [_Compliance Assessment Status_ picklist][1] values for the applicable active _Qualitative Assessment_ records in these columns. Drag and drop the fields to determine the order the columns display to users. If you don't add any fields, users cannot view _Compliance Assessment Statuses_ in the viewer.
13. Optional: Enable users to [bulk create][13] _Qualitative Assessments_ for a _Formulation_ in the viewer:
    * Select the **Enable Bulk Create** checkbox. 
    * Optional: Select a picklist field as the **Bulk Create Secondary Field** that users can populate when in the _Manage Qualitative Assessments for [Formulation Title]_ dialog. This field is only enabled if you added one (1) or more object fields to the _Grid Columns (Regulated Categories)_ field.
14. Optional: Enter [**VQL Criteria**](/en/lr/1037069/) to constrain the _Formulation_ records shown in the viewer based on fields on the _Formulation Composition_ object. For example, to display only _Formulations_ related to _Formulation Compositions_ classified as "Raw Materials", enter `formulation_classification__c = 'raw_material__c'`. This field does not support `IN` or `LIKE` operators or relationships (`__vr` or `__cr`).
15. Click **Done**.
16. Optional: Insert additional **Formulation Composition Viewer** sections to the layout if you want to display different composition criteria within a single _Formulation_ record. For example, one (1) viewer section to display composition inventory status and another to display composition certifications. You can insert up to five (5) viewers to an object's layout.
17. Click **Save** when you are finished updating the layout.

#### Supported Fields {#supported-fields}

Vault supports the following object field types in the _Grid Columns (Formulation Compositions)_ field:

* Name
* Number
* Object
* Object Type
* Picklist
* Text
* Yes/No
* Lookup (so long as the type is a supported type listed above)
* Formula (so long as the return type is a supported type listed above)

### Adding the Formulation Type Field {#formulation-type}

You must add the _Formulation Type_ field to the [object layout](/en/lr/26387/) so you can [define each record][15] as a _Formulation_ or _Packaging Component_ type.

### Inserting Related Object Sections {#sections}

You must insert two (2) related object sections for the _Formulation Composition_ object to the _Formulation_ [object layout](/en/lr/26387/). We recommend labeling the sections "Parent Compositions" and "Child Compositions" so that users can easily add and create relevant related records. When users add child _Formulation Compositions_ to a parent _Formulation_ record, Vault includes the appropriate child _Formulation_ records in the viewer on the parent _Formulation_.

## Configuring the Formulation Composition Object Layout {#fc-layout}

You must add all fields you included in the _Grid Columns (Formulation Compositions)_ field in the [_Formulation Composition Viewer_ section][10] to the _Formulation Composition_ [object layout](/en/lr/26387/). The viewer displays these object fields as columns on the left side of the grid.

We recommend adding the _Formulation Name_ field to the layout. When users add child _Formulation Compositions_ to a parent _Formulation_, Vault populates this field with the _Title_ of the _Formulation_ users select for the _Child_ field.

## Defining Referenced Items {#define}

For users to utilize the viewer, your Vault must include the applicable records:

* **Formulations**: Use the [_Formulation Type_ field][16] to specify type. When this field value is _Packaging Component_, Vault associates the _Formulation_ record with the packaging details of the associated _Product_, allowing users to see the packaging components in the viewer. You cannot change the type after creating the record.
* **Formulation Compositions**: Use the _Parent_ and _Child_ fields to specify the composition of each _Formulation_.
* **Products**: Use the _Formulation_ field to associate each _Product_ with a _Formulation_ and the _Packaging_ field to associate each _Product_ with the applicable components.

<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 use this feature, each raw material in the applicable <em>Formulation</em> can be associated with no more than one (1) supplier. This allows regulatory teams to assess each material in terms of a specific supplier and account for variations such as impurity profiles and total concentrations of constituents.</p>
    </div>
  </div>
</div>



## Limitations

If you plan to configure formulation questionnaire data import, do not use a lifecycle on the _Qualitative Assessment_ object.

## Configuring User Permissions {#user-permissions}

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

* For the _Qualitative Assessment_ object:
    * _Delete_ permission.
    * _Edit_ permission on the _Assessment Status Color_ and _Compliance Assessment Status_ fields.
    * When applicable, users must have _Edit_ permission on the field you added to the _Bulk create secondary field_ in the _Formulation Composition Viewer_ section.
* For the _Formulation_ object: _Read_ permission.
* For the _Formulation Composition_ object:
  * _Read_ permission, including _Read_ permission on the _Formulation Name_ field.
  * _Edit_ permission on any fields included in the _Grid Columns (Formulation Compositions)_ field on the _Formulation Composition Viewer_ section.
* For the _Regulated Category_ object: _Read_ permission, including _Read_ permission on the _Regulated Category (Internal Name)_ field.
* If your Vault utilizes [Atomic Security on fields](/en/lr/47850/#Atomic_Security_Fields), users must also have _Edit_ permission on the appropriate lifecycle states for the applicable fields.
* If your Vault utilizes [DAC](/en/lr/33946/) for the _Qualitative Assessment_ object, users can only view and populate fields for which they have permission to _Read_ and _Edit_.


## 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>Admin: Configuration: Picklists: Edit</td>
    <td>Ability to modify picklist values.</td>
  </tr>
  <tr>
    <td>Security Profile</td>
    <td>Admin: Configuration: Objects: Create, 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 modify permission sets for users.</td>
  </tr>
</table>

[1]: #picklists
[2]: #color-picklist
[3]: #page-layouts
[4]: #ca-page-layout
[5]: #formulation-page-layout
[6]: #supported-fields
[7]: #user-permissions
[8]: #map
[9]: #status
[10]: #viewer
[11]: #sections
[12]: #fc-layout
[13]: #bulk
[14]: #about
[15]: #define
[16]: #formulation-type