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

# SendForProcessing

> Configure the SendForProcessing Pega activity for a single-document case: open the case, loop over attachments, and call FlexiCapture to start batch processing.

For more information about creating activities, see [Creating a Pega activity](/flexi-capture/connectors/pega/pega-activity-create).

## Pages & Classes

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

## Parameters

| **Name** | **Data type** | **Required** |
| -------- | ------------- | ------------ |
| CaseId   | String        | Yes          |

## Local variables

| **Name**    | **Data type** |
| ----------- | ------------- |
| LinkedRefTo | String        |
| Id          | String        |
| Index       | String        |

## Steps

Step 1:

**Method**: Obj-Open-By-Handle.

**Step page**: Case.

**InstanceHandle**: Param.CaseId.

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega105.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=acd7b1240f492e29286b5f2f456d2286" alt="Screenshot of step 1 in Pega configured with the Obj-Open-By-Handle method, the Case step page, and an InstanceHandle of Param.CaseId." width="928" height="279" data-path="images/flexi-capture/connectors/Pega105.png" />
</Frame>

Step 2:

**Method**: Property-Set.

| **PropertiesName** | **PropertiesValue** |
| ------------------ | ------------------- |
| Local.Index        | 0                   |

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega106.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=ba893bb18d8502f0c3db8817817c988c" alt="Screenshot of step 2 in Pega configured with the Property-Set method, a PropertiesName of Local.Index, and a PropertiesValue of 0." width="1116" height="206" data-path="images/flexi-capture/connectors/Pega106.png" />
</Frame>

Step 3:

**Method**: Property-Set.

| **PropertiesName** | **PropertiesValue**                          |
| ------------------ | -------------------------------------------- |
| Local.LinkedRefTo  | Case.pyAttachments(\<CURRENT>).pxLinkedRefTo |
| Local.Id           | Case.pyAttachments(\<CURRENT>).pzInsKey      |

**Loop**:

| **Repeat**                     | **Value List Proeprty** |
| ------------------------------ | ----------------------- |
| For each element in value list | Case.pyAttachments      |

**When**:

| **When**       | **if true**    | **true param** | **if false** | **false param** |
| -------------- | -------------- | -------------- | ------------ | --------------- |
| Local.Index==0 | Continue Whens |                | Skip Step    |                 |

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega107.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=defbfa4362a621026a9ff6e1c23dfff5" alt="Screenshot of step 3 in Pega using the Property-Set method, with Local.LinkedRefTo set to the pxLinkedRefTo of the current Case.pyAttachments element and Local.Id set to its pzInsKey." width="1120" height="238" data-path="images/flexi-capture/connectors/Pega107.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega108.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=dd14bd9d0c06edd5dbced9290efb887a" alt="Screenshot of the Loop dialog in Pega for step 3, with Repeat set to For each element in value list and the Value List Property set to Case.pyAttachments." width="470" height="169" data-path="images/flexi-capture/connectors/Pega108.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega109.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=4af0f2919dcb8e002014ed8ec0270bd2" alt="Screenshot of the When conditions dialog in Pega for step 3, with the condition Local.Index==0 set to Continue Whens if true and Skip Step if false." width="1001" height="235" data-path="images/flexi-capture/connectors/Pega109.png" />
</Frame>

Substep 1:

**Method**: Obj-Open-By-Handle.

**Step page**: Attachment.

**InstanceHandle**: Local.LinkedRefTo

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega110.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=cc92e748bf9483196a8f369a0ed2b065" alt="Screenshot of substep 1 in Pega configured with the Obj-Open-By-Handle method, the Attachment step page, and an InstanceHandle of Local.LinkedRefTo." width="1098" height="310" data-path="images/flexi-capture/connectors/Pega110.png" />
</Frame>

Substep 2:

**Method**: Obj-Open-By-Handle.

**Step page**: AttachmentInfo.

**InstanceHandle**: Local.Id.

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega111.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=e64a8844bd880700afe9c831f93d7ca0" alt="Screenshot of substep 2 in Pega configured with the Obj-Open-By-Handle method, the AttachmentInfo step page, and an InstanceHandle of Local.Id." width="1096" height="313" data-path="images/flexi-capture/connectors/Pega111.png" />
</Frame>

Substep 3:

**Method**: Call-Function.

| **Function**                                                               | **Return value** |
| -------------------------------------------------------------------------- | ---------------- |
| @ABBYY.SendForProcessing(AttachmentInfo.pyMemo, Attachment.pyAttachStream) | .BatchId         |

For more information, see [SendForProcessing](/flexi-capture/connectors/pega/pega-func-one-doc#sendforprocessing).

**Jump**:

| **When**       | **if true**        | **true param** | **if false** | **false param** |
| -------------- | ------------------ | -------------- | ------------ | --------------- |
| StepStatusFail | Jump to Later Step | ERR            |              |                 |

**On exception, jump to later step label**: ERR.

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega112.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=821342a9570521e6691c30f5f147f6b2" alt="Screenshot of substep 3 in Pega using the Call-Function method, with the function @ABBYY.SendForProcessing(AttachmentInfo.pyMemo, Attachment.pyAttachStream) and a return value of .BatchId." width="859" height="189" data-path="images/flexi-capture/connectors/Pega112.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega113.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=4add505d7eabcc578a43d5fa58d00fd7" alt="Screenshot of the Jump conditions for substep 3 in Pega, with a StepStatusFail condition that jumps to later step ERR if true and an on-exception label of ERR." width="998" height="279" data-path="images/flexi-capture/connectors/Pega113.png" />
</Frame>

Substep 4:

**Method**: Call-Function.

| **Function**                                      | **Return value** |
| ------------------------------------------------- | ---------------- |
| @ABBYY.WaitFirstVerificationOrProcessed(.BatchId) | .VerificationUrl |

For more information, see [WaitFirstVerificationOrProcessed](/flexi-capture/connectors/pega/pega-func-one-doc#waitfirstverificationorprocessed).

**Jump**:

| **When**       | **if true**        | **true param** | **if false**       | **false param** |
| -------------- | ------------------ | -------------- | ------------------ | --------------- |
| StepStatusFail | Jump to Later Step | ERR            | Jump to Later Step | INC             |

**On exception, jump to later step label**: ERR

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega114.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=daf5a76f7855f2fdd079d94407995623" alt="Screenshot of substep 4 in Pega using the Call-Function method, with the function @ABBYY.WaitFirstVerificationOrProcessed(.BatchId) and a return value of .VerificationUrl." width="1083" height="235" data-path="images/flexi-capture/connectors/Pega114.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega115.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=764b540e078cd46fa1eecb32a45414dc" alt="Screenshot of the Jump conditions for substep 4 in Pega, with a StepStatusFail condition that jumps to later step ERR if true and INC if false, and an on-exception label of ERR." width="990" height="281" data-path="images/flexi-capture/connectors/Pega115.png" />
</Frame>

Substep 5:

**Label**: ERR.

**Method**: Page-Set-Messages.

**Message**: @unescapeHTML(@getWorstMessageName(tools)).

For more information, see [unescapeHTML](/flexi-capture/connectors/pega/pega-func-other).

**Jump**:

| **When** | **if true**   | **true param** | **if false** | **false param** |
| -------- | ------------- | -------------- | ------------ | --------------- |
| true     | Exit Activity |                |              |                 |

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega116.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=8225fc634ae551bd51dbbc6c1aeadbaf" alt="Screenshot of substep 5 in Pega labeled ERR, using the Page-Set-Messages method with the Message set to @unescapeHTML(@getWorstMessageName(tools))." width="1092" height="241" data-path="images/flexi-capture/connectors/Pega116.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega117.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=e61995d460bec6a0e6c570aac6e98328" alt="Screenshot of the Jump conditions for substep 5 in Pega, with a When value of true that exits the activity." width="931" height="256" data-path="images/flexi-capture/connectors/Pega117.png" />
</Frame>

Substep 6:

**Label**: INC.

**Method**: Property-Set.

| **PropertiesName** | **PropertiesValue** |
| ------------------ | ------------------- |
| Local.Index        | Local.Index+ 1      |

<Frame>
  <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega118.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=c00c72678eb35dc51d238503bb1c37ac" alt="Screenshot of substep 6 in Pega labeled INC, using the Property-Set method with a PropertiesName of Local.Index and a PropertiesValue of Local.Index+ 1." width="1078" height="199" data-path="images/flexi-capture/connectors/Pega118.png" />
</Frame>
