# Setting Up Object Types

An object type is a collection of fields that are grouped to capture similar but not identical data within a single object. For example, the _Product_ object could include two types: _Pharmaceutical_ and _Medical Device_. These object types share fields like _Abbreviation_ and _Internal Name_, but each also has data specific to its business purpose like _Dosage_ for _Pharmaceutical_ and _Model No_ for _Medical Device_.

Not all objects use object types. You must enable and set up object types for individual objects. When this setting is on, each record within the object belongs to a specific object type. For example, a user creating a new _Product_ record must first determine if its a _Medical Device_ or _Pharmaceutical_.

## Setup Overview

To use object types for an object:

  * [Enable object types][1] on the object configuration.
  * [Create custom object types][2] within the object.
  * [Assign fields][3] to specific object types.

## How to Enable Object Types {#enable}

To enable object types on a specific object:

  1. Navigate to **Admin** > **Configuration** > **Objects** > **[Object]**.
  2. Click **Edit** from the Details tab.
  3. Select the **Enable Object Types** checkbox.
  4. Click **Save**.

When you enable object types, Vault automatically:

  * Creates the "base" object type, for example, _Base Product_. Any object fields that exist before enablement are assigned to the base type.
  * Adds the **Object Types** tab to the object configuration area. From this tab, you can see all types that exist within an object, create new types, and assign fields to each type.

## How to Create Object Types {#create}

To create new object types:

  1. From the **Details** tab, navigate to the **Object Types** tab.
  2. Click **Create**.
  3. Enter a **Label** and **Plural Label**.
  4. Optional: Change the **Name** from the default value.
  5. Optional: Provide a **Description** for the object type. This field is used to assist Admins when configuring the object type and is not visible to users.
  6. Optional: Change the **Status** to _Inactive_. This prevents users from creating records with this object type. You may choose to keep the object type inactive until you've completed setup.
  7. Click **Save**.

## How to Assign Fields {#assign}

One of the primary benefits of object types is the ability to reuse some fields across different kinds of data, but not reuse all fields.

To change which fields are assigned to which object types:

  1. From the **Object Types** tab, choose **Edit Object Type Fields** from the actions menu.
  2. Vault shows all object types and fields as a matrix grid. Select checkboxes to apply fields to specific object types. To remove a field from an object type, simply clear the applicable check box. You can apply all fields using the checkbox just below the object type label.
  3. Click **Save**.

### Non-Editable Fields

All fields automatically apply to the base object type. You cannot edit this. There are certain standard fields (including system-managed fields) that apply to all object types, for example, _Created Date_, _Created By_, and _Status_. Required fields always apply to all object types.

### Creating New Fields

When you create a new field on the object, Vault automatically applies it to the base object type only. After creating new fields, you'll need to assign the field to any additional object types it applies to.

Note that any fields you mark as required automatically apply to all object types.

## How to Set Up Required Object Type Fields

When you assign a field to an object type, you can modify the field so it is required only for records of a particular type. This option is only available for custom and optional object type fields. Fields marked as required on the object level apply to object type fields and aren't editable.

To set up required object type fields:

  1. From the **Object Types** tab, open the details for the specified type field by clicking on its checkmark beneath the preferred object type. Object type fields also appear on the object type detail page.
  2. Click **Edit**.
  3. Select the **User must always enter a value (required)** checkbox.
  4. Click **Save**.

When you return to the **Object Types** tab, an asterisk displays next to the checkbox indicating a property override. Additionally, when you hover over the checkmark, a hovercard will display _Required_ under the **Property Overrides** label. Like required fields for objects, required object type fields are automatically added to the Page Layout editor.

## How to Set Up Object Type Field Defaults {#type-defaults}

When you assign a field to an object type, you can also specify a default value for this field which only applies for records of a particular type. This option is only available where [field defaults are supported](/en/lr/42778/). Fields with defaults at the type level override any defaults set at the object level.

For example, the _Corrective Action_ object could include two types: _Internal_ and _Compliance Commitment_. These object types share the _Initial Response Due Date_ field. The _Internal_ corrective action defaults this field to 30 days from today, while the _Compliance Commitment_ type defaults this to only 15 days from today.

Note that you cannot override an object-level default to be blank or null. For example, if the _Corrective Action Base_ type defaults the _Initial Response Due Date_ to 30 days from today, you cannot default this field to blank on the _Internal_ type (have no initial response due date).

To set up required object type fields:

  1. From the **Object Types** tab, open the details for the specified type field by clicking on its checkmark beneath the preferred object type. Object type fields also appear on the object type detail page.
  2. Click **Edit**.
  3. In the **Default Value** section, enter a literal value or use items from the **Fields**, **Functions**, **Operators**, or **Records** tabs to create an expression. Learn more about [setting default field values](/en/lr/42778/#default-examples).
  4. Click **Save**.

When you return to the **Object Types** tab, an asterisk displays next to the checkbox indicating a property override. Additionally, when you hover over the checkmark, a hovercard will display _Field Default_ under the **Property Overrides** label.

## How to Set Up Object Type Picklists {#object-type-picklists}

You can use object type picklists to set up constraints on picklist fields shared across various object types. This allows you to select the values in a picklist that are relevant to a specific object type. For example, the _Pharmaceutical_ and _Medical Device_ object types share the _Therapeutic Area_ field, which identifies whether the record belongs to a specific area of study such as oncology, neurology, pediatrics, etc. You can constrain the _Therapeutic Area_ field to only display the _Pediatrics_ for the _Pharmaceutical_ object type, and _Neurology_ for the _Medical_ _Device_ type.

To set up object type picklists:

  1. From the **Object Types** tab, open the details for the specified type field by clicking on its checkmark beneath the preferred object type. You can also access object type fields on the object type detail page.
  2. Click **Edit**.
  3. Select the **Override picklist values for this object type** checkbox.
  4. Select the applicable picklist value(s) from the **Selected Values** section and move them to the **Available Values** section. You can also remove values that don't apply.
  5. Click **Save**.

When you return to the **Object Types** tab, an asterisk displays next the checkbox indicating a property override. Additionally, when you hover over the checkmark, a hovercard displays _Picklist_ values beneath the **Property Overrides** label.

## How to Set Up Reference Constraints {#reference-constraints}

You can set up constraints on referenced fields shared across various object types. This allows you to restrict the list of available records in a reference field to a list defined values that are relevant to a specific object type. For example, the _Pharmaceutical_ and _Medical Device_ object types reference the _Application_ field. Since these require different types of application, you can set up a constraint on the _Application_ field to only display records where application types are applicable to the specified object type. You can only set up object type reference constraints using a VQL query.

To set up a reference constraint:

  1. From the **Object Types** tab, open the details for the specified type field by clicking on its checkmark beneath the preferred object type. You can also access object type fields on the object type detail page.
  2. Click **Edit**.
  3. Scroll down to the **Constrain Records in Referenced Object** section.
  4. Enter a <a class="external-link " href="https://developer.veevavault.com/vql/#introduction-to-vault-queries" target="_blank" rel="noopener">VQL<i class="fa fa-external-link" aria-hidden="true"></i></a> query to define the conditions.
  5. Click **Preview** to see how field selection will look once your filter rule is in place.
  6. Click **Validate** to validate expression syntax.
  7. Click **Save**.

When you return to the **Object Types** tab, an asterisk displays next to the checkbox indicating a property override. Additionally, when you hover over the checkmark, a hovercard displays _Reference constraints_ beneath the **Property Override** label.

## How to Assign User Actions {#user-actions}

After assigning an [object action](/en/lr/43127/) to an object, you can refine the assignment for each object type. Once you configure an action and add it to an individual object type, Vault displays the action only on records of the specified type. Assigning actions to object types, rather than objects, allows your configuration to reflect your business needs. You can also use [Action Level Security (ALS)](/en/lr/43127/#action-level-security) to control actions at the Security Profile, lifecycle state, and lifecycle role levels.

To assign object actions:

  1. From the **Object Types** tab, click **Actions.**
  2. Choose **Edit Object Type** **Actions** from the **Actions** menu.
  3. Vault shows all object types and available actions in a matrix grid. Select the checkboxes to assign actions to specific object types. To remove an action from an object type, simply deselect the action's checkbox. To apply all actions to an object type, select the checkbox directly beneath the object type label.
  4. Click **Save**.

## How to Delete Object Types

To delete an object type:

  1. From the **Object Types** tab, open the details for a specific type by clicking on its label.
  2. Click **Delete**.
  3. In the confirmation dialog, click **Continue**.

You cannot delete an object type if it's in use. For example, you cannot delete an object type if there are records of that type.

## Limits

You can configure up to 50 object types per object.

 [1]: #enable
 [2]: #create
 [3]: #assign
