# Enable Manual Case Locking: User Check In and Check Out

Learn how to update your Vault's configuration to enable the case locking feature.

## About Case Locking

Case locking configuration settings were added in Veeva Safety 20R2. This feature allows administrators to enable case locking and unlocking as well as filtering by the case lock state. In order to utilize this feature, the proper permissions must be set in the security profile configuration. The case locking layout rule and the Lock Manager security profile must be created before the case locking feature can be properly utilized. 

Once enabled, see <a href="/en/lr/788754/">Manage Strict Case Locking</a> for next steps and <a href="/en/lr/01170/">Lock and Unlock a Case</a> on how to use this feature. 

## Path to Configure Case Locking 

The steps you must perform to configure case locking depend on whether your Vault was deployed in 20R2 or an earlier release. Vaults deployed in 20R2 include much of the required configuration already, while Vaults deployed in an earlier release must perform additional configuration.

### Vaults Deployed In 20R2 or Later  

* <a href="#lock-permissions">Add the Lock Manager Permission Set to Security Profiles</a>
* <a href="#lock-case-user">Add the Case Lock and Unlock User Actions to a State</a>
* <a href="#unlock-entry-action">Add the Case Unlocking Entry Action to Approved State</a>

### Vaults Deployed in 20R1 or Earlier

* <a href="#lock-case-action">Add the Case Locking/Unlocking Actions to the Case Object</a>
* <a href="#lock-case-section">Insert the Case Lock Section on the Case Page Layout</a>
* <a href="#locking-layout-rule">Add the Locking Layout Rule</a>
* <a href="#configure-read">Configure Read Permissions for Locked By and Locked Date</a>
* <a href="#lock-permissions">Add the Lock Manager Permission Set to Security Profiles</a>
* <a href="#lock-case-user">Add the Case Lock and Unlock User Actions to a State</a>
* <a href="#unlock-entry-action">Add the Case Unlocking Entry Action to Approved State</a>

## <a id="lock-case-action"></a>Add the Case Locking/Unlocking Actions to the Case Object

To add the _Case_ locking and unlocking actions:

1. Go to **Configuration > Object Setup > Objects > Case**.
2. Go to the **Actions** tab.
3. Select **Create**.
4. Select the **Lock Case** action from the drop-down menu.
5. Select **Continue**. The Create Action page is displayed. 
    * Ensure the status of the action is **Active**.
6. Select **Save**.
7. Repeat steps 4-7 for the **Unlock Case** action.

## <a id="lock-case-section"></a>Insert the Case Lock Section on the Case Page Layout

To add the _Case Lock_ section to the _Case_:

1. Go to **Configuration > Objects > Case > Layouts > Case Page Layout**.
2. Insert a **Detail Form** section. You may need to remove fields from any section prior to inserting new sections.
3. Fill out the form with the following details:
    * Enter `This Case is Locked` in the **Section Label** field   
    * Enter `this_case_is_locked` in the **Section Name** field   
    * Select **Detail Form - Two Columns** from the drop-down menu
4. Select **Done**. The new section has been inserted at the bottom of the page.
5. Select **Add** to add the following fields to the **This Case is Locked** section:
    * Locked By
    * Locked Date

## <a id="locking-layout-rule"></a>Add the Locking Layout Rule

To add the locking layout rule:

1. From the **Case Page Layout**, select **Layout Rules**. 
2. Add a Layout Rule with the following details:
    * **Label**: `Locking`  
    * **Name**: `locking`
3. Under **Hide the following Page Layout Items:**
    * Select **Sections** from the **Type** drop-down menu  
    * Enter `This Case is Locked` in the **Values** Field
4. Under **IF this Layout Rule Expression is TRUE**, add the following expression: <br>`IsBlank(locked_date__v)`
5. Select **Save**.

## <a id="configure-read"></a>Configure Read Permissions for Locked By and Locked Date

To update permissions for the applicable Permission Sets:

1. Go to **Users & Groups > Permission Sets**.
2. Select a Permission Set. We recommend that you perform the following steps on each Permission Set being used in your Vault.
3. Go to **Objects > Case**.
4. Select **Edit** under the **Object Field Permissions** section.
5. Grant **Read** permissions for the **Locked by** and **Locked Date** fields.
6. Select **Save**. Users in this permission set can now read the **Locked By** and **Locked Date** fields.
7. Repeat steps 1-6 for all other Permission Sets.

## <a id="lock-permissions"></a>Add the Lock Manager Permission Set to Security Profiles

To update the applicable _Security Profiles_:

1. Go to **Users & Groups > Security Profiles**.
2. Open the Security Profile to which you want to grant access to manage case locking.
3. Under **Permission Sets**, select **Add > Existing Permission Set**.
4. Add the **Lock Manager** Permission Set.

## <a id="lock-case-user"></a>Add the Case Lock and Unlock User Actions to a State

To finish enabling the feature, the case locking and unlocking action must be added as user actions for the appropriate Lifecycle States. The recommended states that case locking user actions should be added to are:

* Triage
* Data Entry
* QC
* Medical Coding
* Medical Review
* Revision

The correct conditions must also be set to enable the feature correctly.

### Add the Case Locking User Action

To configure the _Lock Case_ user action:

1. Go to **Configuration > Object Lifecycles > Case Lifecycle**.
2. Select the state to which you want to add the user action.
3. Under **User Actions**, select **Edit**.
4. Select **Create Rule** at the bottom of the page.
5. Select **Perform with conditions**.
6. Beside **If**, select **Locked By** in the first drop-down menu. 
7. Select **is blank** in the second drop-down menu.
8. Under **Allow the following actions**, select **Lock Case**. 
9. In the **Action Label** entry field, enter `Lock Case`.
10. Select **Save**.

### Add the Case Unlocking User Action

To configure the _Unlock Case_ user action:

1. Select **Create Rule** at the bottom of the page.
2. Select **Perform with conditions**.
3. Select **Locked By** in the first drop-down menu beside **If**.
4. Select **is not blank** in the second drop-down menu.
5. Select **Unlock Case** under the **Allow the following actions** heading.
6. Enter `Unlock Case` in the **Action Label** entry field.
7. Select **Save**.

## <a id="unlock-entry-action"></a>Add the Case Unlocking Entry Action to Approved State

To configure the _Unlock Case_ entry action:

1. Go to **Configuration > Object Lifecycles > Case Lifecycle > Approved**.
2. Under **Entry Actions**, select **Edit**.
3. Select **Perform with conditions**.
4. Beside **If**, select **Locked By** in the first drop-down menu. 
5. Select **is not blank** in the second drop-down menu.
6. Under **perform actions**, select **Unlock Case** from the drop-down menu 
7. Select **Save**.