# Using Controlled Vocabularies

Controlled vocabularies in PromoMats allow you to restrict picklist options based on other field values and to prompt users to enter field information during workflow tasks. You can configure controlled vocabularies on document and object fields.

<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>: If you previously configured picklists with field dependencies to restrict available values based on document properties, we recommend creating controlled vocabularies with this information before deactivating the picklists.</p>
    </div>
  </div>
</div>



## Configuring Vocabularies

To create controlled vocabularies:

  1. Navigate to **Business Admin > Picklists > Controlled Vocabulary Type**.
  2. Click **Edit**.
  3. Enter a **Picklist Value Label**, then press the Enter key or click <i class="far fa-plus"></i>.
  4. Navigate to **Business Admin > Objects > Controlled Vocabularies**.
  5. Click **Create**.
  6. Enter a **Controlled Vocabulary Name**. _Controlled Vocabulary Names_ are the picklist options.
  7. Optional: Enter an **Abbreviation**.
  8. Select a corresponding **Controlled Vocabulary Type**.
  9. Click **Save** to finish or click *Save + Create* to create additional vocabularies.

Once you create controlled vocabularies, you can begin applying constraints.

## Adding Constraints

The _Constraint_ object stores allowed metadata combinations. You can use the _Constraint_ object to define when users can select controlled vocabularies. The constraint's <a href="/en/gr/32857/">object types</a>
 indicates which values the _CV_ fields represent. For example, if you create a _Constraint_ object record with the type _Submission_, the _CV1_ field on the _Constraint_ contains submission types while the _CV2_ field contains health authority decisions.

### Adding Constraint Object Types

You can create new _Constraint_ <a href="/en/gr/32857/">object types</a>
 if your _Controlled Vocabulary_ is unrelated to the existing types, or if you have already added criteria VQL expressions to the _CV_ fields in the existing object types.

To add a new object type:

  1. Navigate to **Admin > Configuration > Objects > Constraint > Object Types**.
  2. Enter a **Label**.
  3. Enter a **Plural Label**.
  4. Enter a **Name**.
  5. Click **Save**.
  6. Click the **Actions** menu and select **Edit Object Type Fields**.
  7. Select the appropriate fields, including one (1) or all of the _CV_ fields, then click **Save**.

Next, you can create reference constraints:

  1. Navigate to **Admin > Configuration > Objects > Constraint > Object Types**.
  2. Click the object type label, then select one of the **CV** fields.
  3. Click **Edit**.
  4. <a href="/en/gr/75340/#constrain">Set up a reference constraint</a>
.
  5. Click **Save**.

### Create Constraint Records

To create _Constraint_ records:

  1. Navigate to **Business Admin > Objects > Constraints**.
  2. Click **Create**.
  3. Select a **Constraint Type**.
  4. Optional: Select a **Country**.
  5. Optional: Select a **CV1**. This references a _Controlled Vocabulary_.
  6. Optional: Repeat step 5 for any other _CV_ fields.
  7. Optional: Select a **Product**.
  8. Click **Save** to finish or click **Save + Create** to create additional constraints.

<a class="download-link " href="https://platform.veevavault.help/assets/downloads/controlled-vocabulary-constraint-records.csv" target="_blank" rel="noopener">Download this CSV file to load our recommended constraints<i class="fa fa-download" aria-hidden="true"></i></a>. You can also use it as a starting point when creating unique constraint records using Vault Loader.

## Creating Document & Object Fields

You can apply controlled vocabularies to both document and object fields. 

To apply controlled vocabularies to fields:

  1. Create a <a href="/en/gr/592/#create">new document field</a>
 or <a href="/en/gr/15057/#how_to_add_object_fields">object field</a>
. Select **Object** as the _Field Type_ and **Controlled Vocabulary (controlled_vocabulary__v)** as the _Object_.
  2. Click **Save**.
  3. Find and click on the new field name.
  4. Click **Edit**.
  5. <a href="/en/gr/75340/#constrain">Set up a reference constraint</a>
.
  6. Click **Save**.

The following table includes the relationship names for each _CV_ field on the _Constraint_ object:

| Field | Relatonship Name |
| --- | --- |
| CV1 | constraints1__vr |
| CV2 | constraints2__vr |
| CV3 | constraints3__vr |
| CV4 | constraints4__vr |

By default, the _Health Authority Submission_ and _Health Authority Decision_ document fields include reference constraints. The _Health Authority Decision_ field, for instance, includes the following reference constraint:

`id IN (SELECT id FROM constraints2__vr WHERE cv1__v CONTAINS ), id IN (SELECT id FROM constraints2__vr WHERE country__v CONTAINS ), controlled_vocabulary_type__v = 'health_authority_decision__v', status__v != 'inactive__v'`

### Adding Fields to Workflow Prompts

When adding these document or object fields to workflow task prompts, you must include the fields on which the values are dependent. For example, if you add the _Health Authority Submission_ document field to a task prompt, you must also add the _Country_ field to the task prompt. This allows Vault to read the reference constraint, which contains a dependency on the _Country_.

## Related Permissions

If users cannot see available values when populating document or object fields referring to _Controlled Vocabularies_, ensure their permission set includes _Read_ permissions for the _Controlled Vocabulary_ and _Constraint_ objects.

You can complete all steps in this article with the standard Business Admin, System Admin, or Vault Owner profile. If your vault uses custom security profiles, your profile must grant the following <a href="/en/gr/22824/">permissions</a>
:

| Type | Permission Label | Controls |
| --- | --- | --- |
| Security Profile | Objects: Constraint: Read, Create, Edit, Delete | Grants ability to view, edit, and manage _Constraint_ object records. |
| Security Profile | Objects: Controlled Vocabulary: Read, Create, Edit, Delete | Grants ability to view, edit, and manage _Controlled Vocabulary_ object records. |
