> ## 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.

# Create an activity and add it to your workflow

> Add a Capture Data utility step to your Pega case workflow and create the CaptureData activity with the pages, classes, parameters, and local variables.

The activity runs as a utility step in your case life cycle. It calls the connector function and applies the results to the case.

## Add the utility step to the workflow

<Steps>
  <Step title="Open the case type">
    In **Dev Studio**, open the case type that you created earlier.
  </Step>

  <Step title="Add a life cycle">
    On the **Workflow** tab, click **Add life cycle**.
  </Step>

  <Step title="Create the Collect Information stage">
    Create a first stage with a **Collect Information** step. This step opens the dialog box where files can be added.

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega5.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=8b436cd2d9111798240cdd92d9a6d8c6" alt="Screenshot of the Workflow tab in Pega Dev Studio showing the case life cycle with a single Collect Information stage that contains a Collect Information step." width="581" height="362" data-path="images/flexi-capture/connectors/Pega5.png" />
    </Frame>
  </Step>

  <Step title="Create the Process stage">
    Create a **Process** stage, add any step to this stage such as **Change stage**, and then click **Save**.

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega6.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=43cb73291785c60573f05f08f93965d6" alt="Screenshot of the Workflow tab in Pega Dev Studio showing the case life cycle with a Collect Information stage and a Process stage that contains a Change stage step." width="635" height="217" data-path="images/flexi-capture/connectors/Pega6.png" />
    </Frame>
  </Step>

  <Step title="Open the process flow">
    Click **Records → Process → Flow** to open the list of flows, and then double-click the `Process_Flow` flow for the case type you created earlier.

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega7.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=5cd6edec274217796ad20f4d6e80061b" alt="Screenshot of the Flow instances list in Pega Dev Studio showing the pyStartCase, Process_Flow, and CollectInformation_Flow flows for the case type." width="969" height="223" data-path="images/flexi-capture/connectors/Pega7.png" />
    </Frame>
  </Step>

  <Step title="Replace the step with a Utility step">
    Replace the **Change stage** step with a **Utility** step.

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega23.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=630270234941f44e9b7fd4fb20d66b3c" alt="Screenshot of the Process_Flow diagram in Pega Dev Studio showing the shape menu with Utility selected and the resulting flow with a Utility shape between the Start and End nodes." width="1050" height="436" data-path="images/flexi-capture/connectors/Pega23.png" />
    </Frame>
  </Step>

  <Step title="Create the activity from the Utility step">
    1. Double-click the **Utility** item to open its properties.
    2. Change the name of the item to `Capture Data`.
    3. In the **Rule** field, type `CaptureData` to create a new activity with this name.
    4. Click the icon next to the **Rule** field.
    5. In the window that opens, click **Create and open**.

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega49.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=ec34a8bea0bcef37862e848b6c1cbe40" alt="Screenshot of the Utility step properties in Pega Dev Studio showing the name set to Capture Data, the rule type Activity selected, and CaptureData entered in the Rule field." width="499" height="217" data-path="images/flexi-capture/connectors/Pega49.png" />
    </Frame>
  </Step>
</Steps>

## Declare the pages and classes

On the **Pages & Classes** tab, create the following three objects:

| Page name        | Class                  |
| ---------------- | ---------------------- |
| `Case`           | `Work-`                |
| `Attachment`     | `Data-WorkAttach-File` |
| `AttachmentInfo` | `Data-WorkAttach-File` |

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega11.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=e98c02de75fcac36ea1ae3514a1dc9b5" alt="Screenshot of the Pages and Classes tab of the CaptureData activity in Pega Dev Studio showing the Case, Attachment, and AttachmentInfo pages mapped to the Work- and Data-WorkAttach-File classes." width="959" height="227" data-path="images/flexi-capture/connectors/Pega11.png" />
</Frame>

## Create the parameters

On the **Parameters** tab, create the following three parameters:

| Name            | Data type |
| --------------- | --------- |
| `CaseId`        | `String`  |
| `jsonData`      | `String`  |
| `executionMode` | `String`  |

<Frame>
  <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega31.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=c26312f4b0556614bc3f271afc80bdc8" alt="Screenshot of the Parameters tab of the CaptureData activity in Pega Dev Studio showing the CaseId, jsonData, and executionMode String parameters." width="1309" height="342" data-path="images/flexi-capture/connectors/Pega31.png" />
</Frame>

## Create the local variables

Create the following three local variables:

| Name          | Data type |
| ------------- | --------- |
| `LinkedRefTo` | `String`  |
| `Id`          | `String`  |
| `Index`       | `Integer` |

<Frame>
  <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega32.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=0a086f31fab450012abed0c47813b4e2" alt="Screenshot of the local variables section of the CaptureData activity in Pega Dev Studio showing the LinkedRefTo, Id, and Index variables with their String and Integer data types." width="610" height="278" data-path="images/flexi-capture/connectors/Pega32.png" />
</Frame>
