> ## 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 with a workflow

> Add a Pega case type with the data-model fields and life-cycle stages needed to send documents to ABBYY FlexiCapture, verify them, and fetch captured data.

To create a new case:

1. Open **Dev Studio** and click **Case Types → Add a case type**.
2. Specify a name for your case and click **Submit**.
3. On the **Data model** tab, add new case fields by clicking **Add field**.

Specify the following required fields:

* **Attachments** — *Attachment* type (files) with the option *Category: Attachments;*
  * **BatchId** — *Integer* type (batch identifier)
  * **VerificationUrl** — *Text* type (verification URL)

<Frame>
  <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega59.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=5480a72f48f15bcd23aad25e214b420b" alt="Screenshot of the Data model tab in Pega Dev Studio showing the required Attachments, BatchId, and VerificationUrl case fields with their types and options." width="1453" height="367" data-path="images/flexi-capture/connectors/Pega59.png" />
</Frame>

4. On the **Workflow** tab, click **Add life cycle** and create the following stages with the *Collect information* steps:

<Note>
  You can give any names to the stages and steps.
</Note>

* *Invoice received* is the first stage. At this stage, documents can be added to the case.
  * *Send for processing* is a stage where invoice processing is initiated on the FC side and the program starts waiting for a processing status. At this stage, Pega

* extracts an image from the case attachment.
  * sends the image to FC for processing
  * records the FC batch identifier in the case fields
  * waits for the batch processing to finish
  * updates the case field containing the verification URL if the batch has stopped at the verification stage
  * proceeds to the FC data fetching stage if the batch has been processed completely

* *Verification* – At this stage, a verification page is embedded in the case interface using the iframe element.

  * *Fetching captured data* – At this stage, export results are downloaded from FC and the case fields are filled in.
  * *Next stage* – You can use this stage to include more steps.

  <Frame>
    <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega60.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=4e2a65f7d2cd8a71a3dbade8308ae97d" alt="Screenshot of the Workflow tab in Pega Dev Studio showing the case life cycle with the Invoice received, Send for processing, Verification, Fetching capture data, and Next stage stages." width="1519" height="427" data-path="images/flexi-capture/connectors/Pega60.png" />
  </Frame>

5. Click **Save**.
