> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating a case type

> Create a Pega case type to store document data and originals exported from ABBYY FlexiCapture, configure its data model and views, and add a Delete button.

Your new case will store document data and document originals exported from ABBYY FlexiCapture.

To create a new case type:

1. Once you have [created your Pega application](/flexi-capture/connectors/pega/pega-create-app), click the **Cases** tab on the left and then click **Add a case type**.

2. In the **Add case type** dialog box, type in a name for your case type and click **Submit**.

3. On the **Data model** tab, add the fields to be handled by your case.\
   **Note:** If you are planning to work with table data (e.g. invoice line items), you must also add a field of type **Field group (list)**. In the **Options** column, specify the [data type you created earlier](/flexi-capture/connectors/pega/pega-create-app-data-type) for this type of data.

4. Click **Save** to save the newly created case.

5. If you need to change the data displayed in your case in different views, click the **Views** tab. On this tab:
   * **Create** is the view that you see when you create your case
   * **Review** is the view that you see when you review your case
   * **Edit** is the view that you see when you edit your case
   * **Case attachments** is the view that you see when you display or add attached files
   * **Case details** provides information about your case

6. Click **Submit**.

7. Specify the full name of the case in the **Templates** field of the PEGA configuration file.

<Note>
  The full name of the case is made up of the full name of the application and the name of the case type and has the format "Organization-Name of application-Class-Name of case type." To find out the full name of the application, click the **App** tab on the left.
</Note>

## Adding the ability to delete the case

To be able to delete the case, you need to add a **Delete** button to its UI. Complete the following steps:

1. Click the **App** tab on the left. Then click the name of the case type to expand it and navigate to **User Interface → Section → pyCaseInformation**.
2. On the **Design** tab, click **Add new** and add a new **Button** control.
3. Click the gear icon next to the newly added **Button** control to open its properties. On the **General** tab, replace the default text in the **Button caption** field with **Delete**.
4. While still in the **Cell Properties** dialog box, click the **Actions** tab and then click **Create an action set**. Under **Action set 1**, click **Add an event** and select **Click**. Then click **Add an action → All actions** and select **Run activity** from the **Other** category. In the **Activity** field, type *DeleteCase* as the name for the new activity. Then open the new activity and click **Create and open**.
5. On the **Edit Activity** form, click the **Parameters** tab and add a new **CaseHandle** parameter of type *String*. Then click the **Steps** tab, add the *Obj-Delete-By-Handle* method, and select the boxes next to **Lock**, **ReleaseOnCommit**, and **Immediate**. In the value field of the **InstanceHandle** parameter, type *Param.CaseHandle*. Click **Save** to save your settings.
6. Once the activity is created, type the *.pzInsKey* in the **CaseHandle** field. Next, click **Add a condition** and add a **Cancel** action. In the **Transition** field, select *Go home* (which returns the user to the list of cases) and click **Submit**.
7. In the case editor, click **Save** to save your changes.

The newly created **Delete** button will appear in the case UI. Clicking this button will delete the case and close its page. To update the list of cases, click **Refresh**.
