# Enable MedDRA Query Building Blocks

With the 23R3 release, Veeva Safety introduces _MedDRA Query Building Blocks_ as a more efficient way to meet your organization's adverse event monitoring needs. _Building Blocks_ are reusable queries that combine Standardised MedDRA Queries (SMQs), custom _MedDRA Queries_ (CMQs), and MedDRA terms at any level of the hierarchy. Once configured, you can apply a single building block to multiple _Datasheets_ and _Watchlists_. If a _Building Block_ is updated, a single action applies the changes to any _Datasheet_ or _Watchlist_ using it. 

This automation reduces the administrative burden of maintaining large groups of products with the same adverse event lists, whether for Expectedness evaluations or _Watchlist_ monitoring. This feature offers an alternative to manually maintaining individual MedDRA terms on each _Datasheet_ and _Watchlist_. Using _Building Blocks_ also reduces the need to use Vault Loader for maintenance, saving you extra effort and time.

After configuring this feature, see <a href="/en/lr/01198/#configure-datasheets">Manage Datasheets and Auto-Expectedness: Configure Datasheets</a>, <a href="/en/lr/01192/#set-up-a-watchlist">Configure Adverse Event Watchlists: Set Up a Watchlist</a>, and <a href="/en/lr/01189/">Use MedDRA Queries</a> for more information.

## Update the Datasheet MedDRA Query Layout

Complete the following steps to configure the layout of the **Datasheet MedDRA Query** object:

1. Go to **Admin > Configuration > Objects > Datasheet MedDRA Query > Layouts > Datasheet MedDRA Query Detail Page Layout**.
2. In the **Details** section, we recommend updating the list of fields to the following:
    * **Datasheet**
    * **MedDRA Query**
    * **Scope**
    * **Expectedness**
    * **Seriousness Exclusion**
    * **Active Date Start**
    * **Active Date End**
    * **Description**
3. Insert a **Detail Form** section as follows:
    * **Section Label:** System
    * **Section Layout:** Detail Form - Two Columns
4. In the **System** section, add the following fields:
    * **Created By**
    * **Created Date**
    * **Last Modified By**
    * **Last Modified Date**
5. Select **Save**.

## Update the Datasheet Object and Object Lifecycle

Apply the following changes to the **Datasheet** object and **Datasheet Lifecycle** object lifecycle:

* Insert the **Datasheet MedDRA Query** related object on the layout
* Add the **Update from MedDRA Queries** user action
* Update the **Datasheet Lifecycle** object lifecycle

### Update the Datasheet Layout

Complete the following steps to insert the **Datasheet MedDRA Query** related object on the **Datasheet** object:

1. Go to **Admin > Configuration > Objects > Datasheet > Layouts > Datasheet Detail Page Layout**.
2. Insert the **Datasheet MedDRA Query** related object section, including the following setting:
    * In the **Creation Option** section, select **Create record in pop-up dialog**.
3. In the **Datasheet MedDRA Queries** section, select **Edit Default Columns** to update the list of columns to the following:
    * **MedDRA Query**
    * **Scope**
    * **Expectedness**
    * **Seriousness Exclusion**
    * **Active Date Start**
    * **Active Date End**
    * **Description**
4. Drag and drop to move the **Datasheet MedDRA Queries** section below the **Expected/Unexpected Event Terms** section.
5. Select **Save**.


### Add the Update from MedDRA Queries User Action

Complete the following steps to add the **Update from MedDRA Queries** user action to the **Datasheet** object:

1. Go to **Admin > Configuration > Objects > Datasheet > Actions**.
2. Select **Create**.
3. In the **Create Action** dialog, select **Update from MedDRA Queries** and then select **Continue**.
4. Select **Save**.

### Update the Datasheet Lifecycle Object Lifecycle

Complete the following steps to add the **Update from MedDRA Queries** action to the **Datasheet Lifecycle** object lifecycle:

1. Go to **Admin > Configuration > Object Lifecycles > Datasheet Lifecycle**.
2. In the **States** section, select **Active**.
3. In the **User Actions** section, select **Edit**
4. On the **User Actions** page, select **Create Rule** with the following settings:
   * **Always**
   * **Allow the following actions:** Update from MedDRA Queries
   * **Action Label:** Update from MedDRA Queries
5. Select **Save**.

## Update the Watchlist MedDRA Query Layout

Complete the following steps to configure the layout of the **Watchlist MedDRA Query** object:

1. Go to **Admin > Configuration > Objects > Watchlist MedDRA Query > Layouts > Watchlist MedDRA Query Detail Page Layout**.
2. In the **Details** section, we recommend updating the list of fields to the following:
   * **Watchlist**
   * **MedDRA Query**
   * **Scope**
3. Insert a **Detail Form** section as follows:
   * **Section Label:** System
   * **Section Layout:** Detail Form - Two Columns
4. In the **System** section, add the following fields:
   * **Created By**
   * **Created Date**
   * **Last Modified By**
   * **Last Modified Date**
5. Select **Save**.

## Update the Watchlist Object and Object Lifecycle

Apply the following changes to the **Watchlist** object and **Watchlist Lifecycle** object lifecycle:

* Insert the **Watchlist MedDRA Query** related object on the layout
* Add the **Update from MedDRA Queries** user action
* Update the **Watchlist Lifecycle** object lifecycle

### Update the Watchlist Layout

Complete the following steps to insert the **Watchlist MedDRA Query** related object section on the **Watchlist** layout:

1. Go to **Admin > Configuration > Objects > Watchlist > Layouts > Watchlist Detail Page Layout**.
2. Insert the **Watchlist MedDRA Query** related object section, including the following setting:
   * In the **Creation Option** section, select **Create record in pop-up dialog**.
3. In the **Watchlist MedDRA Queries** section, select **Edit Default Columns** to update the list of columns to the following:
   * **MedDRA Query**
   * **Scope**
4. Drag and drop to move the **Watchlist MedDRA Queries** section below the **MedDRA Terms** section.
5. Select **Save**.

### Add the Update from MedDRA Queries User Action

Complete the following steps to add the **Update from MedDRA Queries** user action to the **Watchlist** object:

1. Go to **Admin > Configuration > Objects > Watchlist > Actions**.
2. Select **Create**.
3. In the **Create Action** dialog, select **Update from MedDRA Queries** and then select **Continue**.
4. Select **Save**.

### Update the Watchlist Lifecycle Object Lifecycle

Complete the following steps to add the **Update from MedDRA Queries** action to the **Watchlist Lifecycle** object lifecycle:

1. Go to **Admin > Configuration > Object Lifecycles > Watchlist Lifecycle**.
2. In the **States** section, select **Active**.
3. In the **User Actions** section, select **Edit**.
4. On the **User Actions** page, select **Create Rule** with the following settings:
   * **Always**
   * **Allow the following actions:** Update from MedDRA Queries
   * **Action Label:** Update from MedDRA Queries
5. Select **Save**.

## Update the MedDRA Query Object and Object Lifecycle

Apply the following changes to the **MedDRA Query** object and **MedDRA Query Lifecycle** object lifecycle:

* Update the **MedDRA Query** layout so that it includes the **MedDRA Query Building Blocks**, **Datasheet MedDRA Queries**, and **Watchlist MedDRA Queries** related objects
* Update the **Layout Rules** to hide sections based on settings
* Add the **Update Datasheet and Watchlist Terms** user action
* Update the **MedDRA Query Lifecycle** object lifecycle

### Update the MedDRA Query Layout

Complete the following steps to insert the **MedDRA Query Building Blocks**, **Datasheet MedDRA Queries**, and **Watchlist MedDRA Queries** related object sections on the **MedDRA Query** layout:

1. Go to **Admin > Configuration > Objects > MedDRA Query > Layouts > MedDRA Query Detail Page Layout**.
2. In the **Details** section, add the **MedDRA Query Type** field.
3. Insert the **MedDRA Query Building Blocks** related object section.
4. Repeat step 3 to insert the **Datasheet MedDRA Queries** and **Watchlist MedDRA Queries** related object sections.
5. Drag and drop so that the sections appear in the following order:
   * **Details**
   * **MedDRA Terms**
   * **MedDRA Query Building Blocks**
   * **Datasheet MedDRA Queries**
   * **Watchlist MedDRA Queries**
   * **Sub-Queries**
   * **Workflow Timeline**
6. Select **Save**.

### Update the Layout Rules

Complete the following steps to hide the **MedDRA Query Building Blocks**, **Datasheet MedDRA Queries**, and **Watchlist MedDRA Queries** sections on **MedDRA Query** records based on settings.

Go to **Admin > Configuration > Objects > MedDRA Query > Layouts > MedDRA Query Detail Page Layout** to configure Layout Rules.

#### Hide When Hierarchical Is Set to No

Complete the following steps to hide the sections when the **Hierarchical** field is set to **No**:

1. On the **MedDRA Query Detail Page Layout** page, select **Layout Rules** and then **Hierarchical**.
2. Select **Edit** and update the Layout Rule with the following details:
   * **IF this Layout Expression is TRUE**: <code>hierarchical__v</code>
   * **Apply the following display effects:**
     * **Effect:** Hide
     * **Type:** Sections
     * **Values:** MedDRA Terms
3. Select **Save**.

#### Hide When MedDRA Query Type is Not Set to No

Complete the following steps to hide the sections when the **MedDRA Query Type** field is not set to **No**:

1. On the **MedDRA Query Detail Page Layout** page, select **Layout Rules** and then **Create**.
2. Complete the **Create Layout Rule** form with the following details:
   * **Label**: Not Building Blocks
   * **Name**: <code>not_building_blocks__c</code>
   * **IF this Layout Expression is TRUE**: <code>meddra_query_type__v != "building_block__v" || hierarchical__v</code>
   * **Apply the following display effects:**
     * **Effect:** Hide
     * **Type:** Sections
     * **Values:** MedDRA Query Building Blocks, Datasheet MedDRA Queries, Watchlist MedDRA Queries
3. Select **Save**.

### Add the Update Datasheet and Watchlist Terms User Action

Complete the following steps to add the **Update Datasheet and Watchlist Terms** user action to the **MedDRA Query** object:

1. Go to **Admin > Configuration > Objects > MedDRA Query > Actions**.
2. Select **Create**.
3. In the **Create Action** dialog, select **Update Datasheet and Watchlist Terms** and then select **Continue**.
4. Select **Save**.

### Update the MedDRA Query Lifecycle Object Lifecycle

Complete the following steps to add the **Update Datasheet and Watchlist Terms** action to the **MedDRA Query Lifecycle** object lifecycle:

1. Go to **Admin > Configuration > Object Lifecycles > MedDRA Query Lifecycle**.
2. In the **States** section, select **Active**.
3. In the **User Actions** section, select **Edit**.
4. On the **User Actions** page, select **Create Rule** with the following settings:
   * **Always**
   * **Allow the following actions:** Update Datasheet and Watchlist Terms
   * **Action Label:** Update Datasheet and Watchlist Terms
5. Select **Save**.

## Update the MedDRA Query Building Block Object

Complete the procedures in this section to update the layout of the **MedDRA Query Building Block** object and add a VQL constraint to the **MedDRA Query** field.

Go to **Admin > Configuration > Objects > MedDRA Query Building Block** to make the changes.

### Update the MedDRA Query Building Block Layout

Complete the following steps to update the layout of the **MedDRA Query Building Block** object:

1. On the **Layouts** tab, select **MedDRA Query Building Block Detail Page Layout**.
2. In the **Details** section, we recommend updating the list of fields to the following:
   * **CMQ**
   * **MedDRA Query**
   * **Scope**
3. Insert a **Detail Form** section as follows:
   * **Section Label:** System
   * **Section Layout:** Detail Form - Two Columns
4. In the **System** section, add the following fields:
   * **Created By**
   * **Created Date**
   * **Last Modified By**
   * **Last Modified Date**
5. Select **Save**.

### Add a VQL Constraint to the MedDRA Query Field

To ensure only SMQs and CMQs can be added to a MedDRA Query Building Block, add the following VQL constraint to the **MedDRA Query** field:

1. On the **Fields** tab, select **MedDRA Query**.
2. Select **Edit**.
3. In the **Criteria VQL** field, enter <code>meddra_query_type__v != 'building_block__v'</code>.
4. Select **Save**.
