# Setting Up Batch Release

Batch Release is an application in the Quality suite used by pharmaceutical companies to review batches for compliance so they can be dispositioned for use and shipment within their supply chain. The <a href="/en/gr/713885/">Batch Release Execution page</a> facilitates this process by automatically aggregating batch-related information from quality, regulatory, and manufacturing systems so they can be checked in a unified interface, to support a disposition decision.

You can configure a workflow to collect decisions from reviewers and solicit release decisions and their approval while managing the lifecycle states of each _Batch Disposition_ record. Release decisions are typically made after their checks are compliant. Additionally, you can configure compliance logic for checks. This article outlines the configuration steps required to set up the Batch Release feature for your organization's business needs.

## Setup Overview

Complete the following setup and configuration steps to set up the batch release capability in your Vault:

  1. Define [_Batch Disposition Plans_][1].
  2. Define [_Batch Disposition Check Requirements_][2].
  3. Define [_Batch Disposition Item Requirements_][3].
  4. Approve [_Batch Disposition Plans_][4] for use.
  5. Configure [entry and user actions][5] and [Action Triggers][9] for automation.
  6. Optional: Configure <a href="/en/gr/781134/">Batch Release roles</a>.

## Creating Batch Disposition Plans {#plans}

You can define batch _Batch Disposition Plans_ to provide a template for users to automatically create _Batch Disposition_ records for a batch of a specified material with all associated _Batch Disposition Checks_ and _Batch Disposition Item Requirements_. Plans will also define security, accountability, required approvals, and default due date for the _Batch Disposition_.

To create a _Batch Disposition Plan_:

  1. Navigate to **Business Admin > Batch Disposition Plans** or to a <a href="/en/gr/23516/">custom tab</a> tab for _Batch Disposition Plans_.
  2. Click **Create**.
  3. In the _Create a New Disposition_ dialog, select a **Batch Disposition Plan Type** from the drop-down and click **Continue**. If you select a _Market Ship_ type disposition, you must also select the [applicable markets][7] from the drop-down.
  4. Populate the **Title**, **Due Date Offset Days**, **Disposition Title**, and **Owner** fields.
  5. Optional: Select the **Auto Generate Disposition** checkbox to enable Vault to asynchronously generate a _Batch Disposition_ record for a particular _Batch_ when the _Batch_ enters a specified lifecycle state.
  6. Populate any remaining required fields and click **Save**.

Upon creation, the _Batch Disposition Plan_ is in the _In Design_ state. From the related object sections, you can associate the plan with _Materials_ and _Check Requirements_. You must review and approve _Batch Disposition Plan_ records in order for them to become _Effective_ for use.

### Parent and Child Batch Disposition Plans

Additionally, users can create a parent _Batch Disposition Plan_ to manage plans for hundreds or thousands of _Materials_ that share common _Check Requirements_ and varying material-specific requirements. Common _Check Requirements_ are managed in the parent plan, and material-specific requirements are managed in the child plan. Vault then combines the child and parent plans to create a _Batch Disposition_.

A child _Batch Disposition Plan_ can have only one (1) parent plan. Users cannot enter a plan in the _Parent Plan_ field if the selected plan already has a child or parent plan associated. Fields on the child plan take precedence over fields on the parent plan, but if a field is blank on a child plan, the corresponding field on the parent plan is used instead. A parent plan can point to the same _Check Requirement_ as a child plan, but only the _Check Requirement_ for the child plan is used, to ensure that duplicate checks are not created. A parent plan with materials associated creates _Batch Dispositions_ based on its _Check Requirements_ and configuration only.

Admins can configure the _Batch_ object to determine which _Date_ or _DateTime_ field is used in a _Batch Disposition Plan_ to calculate _Batch Disposition Plan_ and _Batch Disposition Check_ due dates. This allows Vault to use more than the standard _Manufacturing Date_ field for calculating due dates. Both the _Date_ and _DateTime_ fields are available for use, but if neither field is selected, the standard _Manufacturing Date_ field is used by default. Child _Batch Disposition Plans_ inherit their values from their parent plans so both the _Date_ and _DateTime_ fields need to be blank before Vault will use the standard _Manufacturing Date_ field. The _Due Date_ field UI control must be added to the _Batch Disposition Plan_ layout to enable this capability.

### Manufacturing Site-Specific Plans

Users can associate a _Batch Disposition Plan_ with a manufacturing site to ensure that only batches manufactured at that site are dispositioned by that plan. This can be helpful if your organization has manufacturing site-specific requirements to meet.

By utilizing the _Disposition Plan - Organization_ join object, users can establish a relationship between the _Batch Disposition Plan_ and their organization. When the _Batch Disposition Plan_ has at least one (1) relationship with an organization, the plan becomes a manufacturing site-specific plan that can only be used by batches manufactured at that site.

### Batch Disposition Plan Dependencies

Batch materials with multiple _Batch Disposition Plans_ can have dependencies that block a disposition decision until other disposition decisions are made. For example, if configured by an Admin, your organization can block all market-ship decisions until the batch's GMP _Batch Disposition_ is closed and accepted.

The _Related Disposition Plan_ object is used to create dependencies between _Batch Disposition Plans_. As _Batch Dispositions_ are created, Vault creates _Batch Disposition Item_ records based on these dependencies, which are closed when blocking _Batch Dispositions_ are closed. A dependent _Batch Disposition_ record will not be created if a blocking _Batch Disposition_ record does not exist.

### Market Ship Decisions {#market-ship}

When creating a _Market Ship_ type _Batch Disposition Plan_, you must add the applicable markets. When users create a disposition, Vault creates a _Batch Disposition - Country_ record and market-specific checks for each market selected. When configured, click the **All Actions** menu on the _Disposition_ and click **Edit Markets** to add or remove _Markets_ on an existing _Disposition_. When you remove a _Market_ from an open disposition, Vault deletes the corresponding _Batch Disposition - Country_ record and cancels any related checks and items.

Vault displays the two character country code for each market below the name on _Batch Disposition Plans_. Vault displays a green circle (<i class="fas fa-circle" style="color: #539137;"></i>) icon next to the country code when all market-specific checks are completed, and a green circle with a checkmark (<i class="fas fa-check-circle" style="color: #539137;"></i>) icon when the disposition is closed and accepted.

## Creating Batch Disposition Check Requirements {#check-requirements}

You can create multiple _Batch Disposition Check Requirements_ for a _Batch Disposition Plan_ as reusable requirements configured to check a requirement for a _Batch Disposition_.

To create a _Batch Disposition Check Requirement_:

  1. Navigate to **Business Admin > Batch Disposition Check Requirements** or to a custom tab for _Batch Disposition Check Requirements_.
  2. Click **Create**.
  3. From the dialog, select a **Batch Disposition Check Requirement Type** from the drop-down and click **Continue**.
  4. Populate the **Title**, **Check Title**, and **Document Type** fields.
  5. Click the binoculars icon, select a **Type**, a **Subtype**, and a **Classification** for monitoring documents, and then click **OK**.
  6. Optional: Select _Yes_ for the **Automatic** field to enable Vault to [automatically complete _Batch Disposition Checks_ upon item closure][6] so that users don't need to make a decision to move them forward to be ready.
  7. Populate any remaining required fields and click **Save**.

Upon creation, the _Batch Disposition Check Requirement_ is in the _In Design_ state. From the related object sections, you can associate the plan with _Batch Disposition Item Requirements_.

### Creating Batch Disposition Item Requirements {#item-requirements}

You can create multiple _Batch Disposition Item Requirements_ for a given _Batch Disposition Check Requirement_. Item requirements relate a document template to a plan so that the document is created for every disposition created from the plan.

To create a _Batch Disposition Item Requirement_:

  1. Navigate to **Business Admin > Batch Disposition Check Requirements** or to a custom tab for _Batch Disposition Check Requirements_.
  2. Select a record and navigate to the _Item Requirements_ section.
  3. Click **Create**.
  4. Select a **Document** and click **Save**.

## Reviewing & Approving Batch Disposition Plans {#review-and-approve}

Business administrators or quality managers must design, revise, and approve _Batch Disposition Plans_ with all specified required checks needed for a given material and its intended market or usage. Upon approval, you can create _Batch Dispositions_ from a plan for every batch of the specified material type.

Vault manages the revision and approval of _Batch Disposition Plans_ through user actions to progress the _Batch Disposition Plan_ through its lifecycle. All _Batch Disposition Check Requirements_ must be in the _Effective_ state before the _Batch Disposition Plan_ can transition to _Effective_.

## Sharing Batch Disposition Documents

To enable Batch Release users to share _Batch Disposition_ documents with external VeevaID users, Admins can configure the _Share Disposition_ [entry or user action][10]. Vault sends the selected persons an email with a link to the _Batch Disposition Share App Page_, where they can view and download selected documents as PDF files.

You can add and select persons in the _Persons_ section on the _Batch Disposition Plan_ with _Type_ set to _Share Disposition_ or, when configured, in the _Share Disposition_ dialog after performing the _Share Disposition_ user action. Persons must have a user account to be added to the _Batch Disposition Plan_.

You can select which documents to share for a given _Batch Disposition_ using the _Share_ field on the _Batch Disposition Plan_ and the _Share_ field in the _Check Requirements_ sections. The _Batch Disposition Share App Page_ displays a maximum of 100 documents.

When you share a Disposition, Vault gives the users the _Consumer_ role for documents and _Viewer_ role for the Disposition.

## Batch Disposition Item Status

The _Item Creation Status_ picklist on the _Batch Disposition_ object is set during the creation of a Batch Disposition. When the _Disposition_ creation job begins, the _Item Creation Status_ is set to _In Progress_. When complete, Vault updates the field to _Done_. In the event that the job fails, Vault sets the _Item Creation Status_ to _Failed_.

## Batch Release Automation Actions {#automation}

### Configuring an Entry Action to Create Batch Dispositions

Admins can configure Vault to automatically create a _Batch Disposition_ record for a particular _Batch_ when the _Batch_ is activated. You must configure the **Create Batch/Lot Disposition Record** action as an entry action on the _Active_ state of the _Batch Lifecycle_. You can also configure this as a user action.

### Configuring Check Requirements to Complete Checks {#close-checks}

Admins can configure Vault to automatically complete _Batch Disposition Checks_ once all _Batch Disposition Items_ are closed so that users don't need to make a decision to move them forward to be ready. You must configure this in the _Batch Disposition Check Requirement_ with the _Automatic_ field set to _Yes_.

### Configuring an Entry Action to Close Checks

Admins can configure associated _Batch Disposition Checks_ to close automatically upon the closure of the _Batch Disposition_ record. You must configure an entry action on the _Closed_ state of the _Batch Disposition Lifecycle_ to change the state of all associated _Batch Disposition Checks_ to _Closed_.

### Configuring an Action Trigger to Close Items {#action-triggers}

Admins can configure <a href="/en/gr/811001/">Action Triggers</a> to automatically close _Batch Disposition Items_ based on related record criteria.

We recommend configuring the following Action Triggers:

  * To change the state of the _Batch Disposition Item_ to _Closed_ if the related **Deviation** record is _Closed_ and if the _Impact Batch?_ field is blank:
    * **Deviation** object
    * After Save
    * `If Not(IsBlank(deviation__v)) && deviation__vr.state__v="closed_state__v" && CountA(GetRecords($deviation_batch__v, "quality_batch__v =  and deviation__v =  and batch_impact__v = true")) = 0 && CountA(GetRecords($deviation_batch__v, "quality_batch__v =  and deviation__v =  and batch_impact__v = null")) = 0;`
    * `Then ChangeState(ThisRecord(), $closed_state__v);`
  * To change the state of the _Batch Disposition Item_ to _Closed_ if the related **Change Control** record is _Closed_:
    * **Change Control** object
    * After Save
    * `If Not(IsBlank(change_control__v)) && change_control__vr.state__v="closed_state__v";`
    * `Then ChangeState(ThisRecord(), $closed_state__v);`
  * To change the state of the _Batch Disposition Item_ to _Closed_ if the related **Quality Event** (**Deviation** type) record is _Closed_ and the _Impact Batch?_ field is blank:
    * **Deviation** type of the **Quality Event** object
    * After Save
    * `If Not(IsBlank(quality_event__v)) && quality_event__vr.state__v="closed_state__c" && quality_event__vr.object_type__vr.api_name__v="deviation__qdm" && CountA(GetRecords($quality_event_batches__v, "quality_batch__v =  and quality_event__v =  and batch_impact__v = true")) = 0 && CountA(GetRecords($quality_event_batches__v, "quality_batch__v =  and quality_event__v =  and batch_impact__v = null")) = 0;`
    * `Then ChangeState(ThisRecord(), $closed_state__v);`
  * To change the state of the _Batch Disposition Item_ to _Closed_ if the related **Quality Event** record is _Closed_:
    * **Quality Event** object
    * After Save
    * `If Not(IsBlank(quality_event__v)) && quality_event__vr.state__v="closed_state__c";`
    * `Then ChangeState(ThisRecord(), $closed_state__v);`
  * To change the state of the _Batch Disposition Item_ to _Closed_ if the related **Batch Disposition** record is _Closed_:
    * **Batch Disposition** object
    * After Save
    * `If Not(IsBlank(input_batch_disposition__v)) && batch_disposition__vr.state__v="closed_state__v";`
    * `Then ChangeState(ThisRecord(), $closed_state__v);`

### Configuring an Entry Action to Share Dispositions {#share-disposition-actions}

Admins can configure Vault to automatically share selected _Batch Disposition_ documents with users, including external users with VeevaID. You must configure the **Share Disposition** action as an entry action on the _Closed_ state of the _Batch Disposition Lifecycle_. You can also configure this action as a user action in any state that your process requires. 

### Configuring the Batch Release Workflow User Action

Admins should ensure that the **Start Disposition Workflow** user action is configured on the _Batch Disposition Lifecycle_ for the _Open_ state. This action starts the batch release workflow and sends a task to the assigned reviewer.

### Configuring the Disposition Plan - Organization Object

Admins can configure the _Disposition Plan - Organization_ join object to establish relationships between a _Batch Disposition Plan_ and an organization. When a _Batch Disposition Plan_ has at least one (1) relationship with an organization, the plan becomes a manufacturing site-specific plan that can only be used by batches manufactured at that site. If no relationship is established with a manufacturer's site, the plan can be used by batches made anywhere. To utilize this join object, add the section for the _Disposition Plan - Organization_ join object to the _Batch Disposition Plan_ <a href="/en/gr/26387/">object layout</a>.

### Configuring Item Requirements

Admins can configure an Item Requirement on a Check Requirement which will create documents with the _Batch_ field populated when a _Batch Disposition_ is created.

Admins can specify whether to copy the document referenced in the Item Requirement or create an item reference for an existing document without copying it. This supports material-specific and manufacturing-specific documents like BSE/TSE certifications and other certifications that cover all batches produced during a specific period at a specific manufacturing site or for a specific material, to ensure that the batch was manufactured when the certifications were _Effective_. To apply this setting, select **No** from the _Batch Disposition Item Requirement Copy Document_ picklist field.

### Configuring Due Date Handling

Admins can configure whether due dates are displayed on the <a href="/en/gr/713885/">Batch Release Execution page</a> in a date or a date and time format. If an Admin enables the **Use Datetime field for Due Dates** option under **Admin > Settings > Application Settings**, Vault displays the _Due Date_ field on a _Batch Disposition_ in the date and time format. If this option is not enabled, Vault displays the date format by default. To support this functionality, Admins need to add the _Due Date_ (`due_date_only__v`) field to the _Batch Disposition_ (`batch_disposition__v`) page layout.

## Batch Release Manual Actions {#manual}

### Configuring Disposition Item Behavior

Admins can configure Vault to allow users to make decisions and justifications for _Batch Disposition Items_ and close them from the Batch Release Execution page.

Begin by adding the _Item Behavior_ (`batch_disposition_check__v.item_behavior__v`) picklist to the _Batch Disposition Check Requirement_ and _Batch Disposition Check_ object page layouts. When you set the picklist to **Automatic & Manual**, users can add decisions and justifications to _Batch Disposition Items_ and close them from the Batch Release Execution page. When the picklist is set to **Automatic Only** or left blank, Vault closes items through automated action triggers or entry actions on the related record.

Also configure the _Compliant_ user action on the _Batch Disposition Item_ lifecycle in the _Open_ state to set the lifecycle state to _Closed_ and _Decision_ to _Compliant_.  Then configure the _Not Compliant_ user action on the _Batch Disposition Item_ lifecycle in the _Open_ state to set the decision to _Not Compliant_ and the lifecycle state to _Closed_.

### Adding & Removing Markets

Admins can configure Vault to allow users to add or remove _Markets_ on _Batch Disposition Plans_. To do this, configure the _Edit Markets_ user action on applicable states in the _Batch Disposition Lifecycle_. When users add a _Market_ to an open disposition, Vault creates a _Batch Disposition - Country_ object record for that market and any market-specific checks. When users remove a _Market_ from an open disposition, Vault deletes the corresponding _Batch Disposition - Country_ record and cancels any corresponding checks and items. 

## Related Permissions

In order to set up Batch Release, your permission set should have _Read_, _Create_, and _Edit_ permissions to the following objects and their fields:

  * _Batch Disposition Plan_ (`disposition_plan__v`)
  * _Batch Disposition Check Requirement_ (`batch_disposition_check_requirement__v`)
  * _Batch Disposition Item Requirement_ (`batch_disposition_item_requirement__v`)
  * _Batch Disposition_ (`batch_disposition__v`)
  * _Batch Disposition Checks_ (`batch_disposition_check__v`)
  * _Batch Disposition Items_ (`batch_disposition_item__v`)

 [1]: #plans
 [2]: #check-requirements
 [3]: #item-requirements
 [4]: #review-and-approve
 [5]: #automation
 [6]: #close-checks
 [7]: #market-ship
 [8]: #manual
 [9]: #action-triggers
 [10]: #share-disposition-actions