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

# FetchingCapturedData activity for a multi-document case

> Set up the FetchingCapturedData Pega activity for a multi-document case: fetch captured JSON by template name and branch to the matching data transform.

The `FetchingCapturedData` activity retrieves the captured data for one Document Definition and applies the data transform that matches the template name it is given.

For the general procedure, see [Create a Pega activity](/flexi-capture/connectors/pega/pega-activity-create).

## Pages and classes

| Page name | Class   |
| --------- | ------- |
| `Case`    | `Work-` |

## Parameters

| Name            | Data type | Required |
| --------------- | --------- | -------- |
| `CaseId`        | `String`  | Yes      |
| `templateName`  | `String`  | Yes      |
| `jsonData`      | `String`  | No       |
| `executionMode` | `String`  | No       |

## Activity steps

<Steps>
  <Step title="Open the case">
    | Field              | Value                |
    | ------------------ | -------------------- |
    | **Method**         | `Obj-Open-By-Handle` |
    | **Step page**      | `Case`               |
    | **InstanceHandle** | `Param.caseId`       |

    <Frame>
      <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega148.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=edf58a44aef0a09546dfa10358449c35" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 1 with the Obj-Open-By-Handle method on the Case step page and InstanceHandle set to Param.caseId." width="1098" height="324" data-path="images/flexi-capture/connectors/Pega148.png" />
    </Frame>
  </Step>

  <Step title="Fetch the captured data">
    Set **Method** to `Property-Set` and the properties as follows:

    | PropertiesName        | PropertiesValue                                             |
    | --------------------- | ----------------------------------------------------------- |
    | `Param.executionMode` | `DESERIALIZE`                                               |
    | `Param.jsonData`      | `@ABBYY.FetchingCapturedData(.BatchId, Param.templateName)` |

    For more information, see [FetchingCapturedData](/flexi-capture/connectors/pega/pega-func-multiple-docs#fetchingcaptureddata).

    Add the following **Jump** conditions, which route each template to its own data transform, and set **On exception, jump to later step label** to `ERR`:

    | When                                 | if true            | true param | if false       | false param |
    | ------------------------------------ | ------------------ | ---------- | -------------- | ----------- |
    | `StepStatusFail`                     | Jump to Later Step | `ERR`      | Continue Whens |             |
    | `Param.templateName=="Invoice_eng"`  | Jump to Later Step | `INVOICE`  | Continue Whens |             |
    | `Param.templateName=="Banking_eng"`  | Jump to Later Step | `BANKING`  | Continue Whens |             |
    | `Param.templateName=="Contract_eng"` | Jump to Later Step | `CONTRACT` | Continue Whens |             |
    | `Param.templateName=="Letter_eng"`   | Jump to Later Step | `LETTER`   | Continue Whens |             |
    | `Param.templateName=="Price_eng"`    | Jump to Later Step | `PRICE`    | Exit Activity  |             |

    <Frame>
      <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega149.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=28e65ccdd575fd32da470cb286bc4e45" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 2 with the Property-Set method setting Param.executionMode to DESERIALIZE and Param.jsonData to @ABBYY.FetchingCapturedData(.BatchId, Param.templateName)." width="1105" height="247" data-path="images/flexi-capture/connectors/Pega149.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega150.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=aa466bb5c6ef65b6056e1bcf2c0ef3b9" alt="Screenshot of the Jump conditions dialog for Step 2 in Pega, showing conditions that route to label ERR on StepStatusFail and to the INVOICE, BANKING, CONTRACT, LETTER, and PRICE labels based on the value of Param.templateName." width="989" height="451" data-path="images/flexi-capture/connectors/Pega150.png" />
    </Frame>
  </Step>

  <Step title="Apply the invoice data transform">
    | Field                 | Value                 |
    | --------------------- | --------------------- |
    | **Label**             | `INVOICE`             |
    | **Method**            | `Apply-DataTransform` |
    | **DataTransform**     | `jsonToInvoice`       |
    | **PassParameterPage** | `true`                |

    For more information, see [jsonToInvoice](/flexi-capture/connectors/pega/pega-dt-many-docs#jsontoinvoice).

    Add the following **Jump** condition, and set **On exception, jump to later step label** to `ERR`:

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/KEmWsO92hkr7eybZ/images/flexi-capture/connectors/Pega151.png?fit=max&auto=format&n=KEmWsO92hkr7eybZ&q=85&s=201c65905a310364d529b907a47d0c80" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 3 labeled INVOICE with the Apply-DataTransform method, the DataTransform parameter set to jsonToInvoice, and PassParameterPage selected." width="1097" height="205" data-path="images/flexi-capture/connectors/Pega151.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega152.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=ed5d0dc273bc37635d92f5b0ca463b89" alt="Screenshot of the Jump conditions dialog for Step 3 in Pega, showing a When condition of true set to Exit Activity, with the on-exception label set to ERR." width="991" height="276" data-path="images/flexi-capture/connectors/Pega152.png" />
    </Frame>
  </Step>

  <Step title="Apply the banking data transform">
    | Field                 | Value                 |
    | --------------------- | --------------------- |
    | **Label**             | `BANKING`             |
    | **Method**            | `Apply-DataTransform` |
    | **DataTransform**     | `jsonToBanking`       |
    | **PassParameterPage** | `true`                |

    For more information, see [jsonToBanking](/flexi-capture/connectors/pega/pega-dt-many-docs#jsontobanking).

    Add the following **Jump** condition, and set **On exception, jump to later step label** to `ERR`:

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega153.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=9fe6bd2c207de65ffb2044c4e0b170fa" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 4 labeled BANKING with the Apply-DataTransform method, the DataTransform parameter set to jsonToBanking, and PassParameterPage selected." width="1101" height="198" data-path="images/flexi-capture/connectors/Pega153.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega154.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=92f565029dd24f1608b27687190ed15d" alt="Screenshot of the Jump conditions dialog for Step 4 in Pega, showing a When condition of true set to Exit Activity, with the on-exception label set to ERR." width="989" height="271" data-path="images/flexi-capture/connectors/Pega154.png" />
    </Frame>
  </Step>

  <Step title="Apply the contract data transform">
    | Field                 | Value                 |
    | --------------------- | --------------------- |
    | **Label**             | `CONTRACT`            |
    | **Method**            | `Apply-DataTransform` |
    | **DataTransform**     | `jsonToContract`      |
    | **PassParameterPage** | `true`                |

    For more information, see [jsonToContract](/flexi-capture/connectors/pega/pega-dt-many-docs#jsontocontract).

    Add the following **Jump** condition, and set **On exception, jump to later step label** to `ERR`:

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega155.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=a7a124fb7b177d5093435acbf2c73a22" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 5 labeled CONTRACT with the Apply-DataTransform method, the DataTransform parameter set to jsonToContract, and PassParameterPage selected." width="1109" height="210" data-path="images/flexi-capture/connectors/Pega155.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega156.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=2795ce2c38a5dafbf3e1db76eead3a29" alt="Screenshot of the Jump conditions dialog for Step 5 in Pega, showing a When condition of true set to Exit Activity, with the on-exception label set to ERR." width="998" height="274" data-path="images/flexi-capture/connectors/Pega156.png" />
    </Frame>
  </Step>

  <Step title="Apply the letter data transform">
    | Field                 | Value                 |
    | --------------------- | --------------------- |
    | **Label**             | `LETTER`              |
    | **Method**            | `Apply-DataTransform` |
    | **DataTransform**     | `jsonToLetter`        |
    | **PassParameterPage** | `true`                |

    For more information, see [jsonToLetter](/flexi-capture/connectors/pega/pega-dt-many-docs#jsontoletter).

    Add the following **Jump** condition, and set **On exception, jump to later step label** to `ERR`:

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega157.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=a6b337ee6e900d5e953495f308008e71" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 6 labeled LETTER with the Apply-DataTransform method, the DataTransform parameter set to jsonToLetter, and PassParameterPage selected." width="1095" height="201" data-path="images/flexi-capture/connectors/Pega157.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega158.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=c7d9fe5bdd3ab0464d78f11f3c8b09d5" alt="Screenshot of the Jump conditions dialog for Step 6 in Pega, showing a When condition of true set to Exit Activity, with the on-exception label set to ERR." width="994" height="285" data-path="images/flexi-capture/connectors/Pega158.png" />
    </Frame>
  </Step>

  <Step title="Apply the price data transform">
    | Field                 | Value                 |
    | --------------------- | --------------------- |
    | **Label**             | `PRICE`               |
    | **Method**            | `Apply-DataTransform` |
    | **DataTransform**     | `jsonToPrice`         |
    | **PassParameterPage** | `true`                |

    For more information, see [jsonToPrice](/flexi-capture/connectors/pega/pega-dt-many-docs#jsontoprice).

    Add the following **Jump** condition, and set **On exception, jump to later step label** to `ERR`:

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega159.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=d51f91dd559e7023aaaea8df5150fdc6" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 7 labeled PRICE with the Apply-DataTransform method, the DataTransform parameter set to jsonToPrice, and PassParameterPage selected." width="1103" height="188" data-path="images/flexi-capture/connectors/Pega159.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega160.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=9880110d6d5f21129cabfb77772104ba" alt="Screenshot of the Jump conditions dialog for Step 7 in Pega, showing a When condition of true set to Exit Activity, with the on-exception label set to ERR." width="998" height="277" data-path="images/flexi-capture/connectors/Pega160.png" />
    </Frame>
  </Step>

  <Step title="Post the error message">
    | Field       | Value                                        |
    | ----------- | -------------------------------------------- |
    | **Label**   | `ERR`                                        |
    | **Method**  | `Page-Set-Messages`                          |
    | **Message** | `@unescapeHTML(@getWorstMessageName(tools))` |

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

    <Frame>
      <img src="https://mintcdn.com/abbyy/Xgx3EG8BZs5YQjIJ/images/flexi-capture/connectors/Pega161.png?fit=max&auto=format&n=Xgx3EG8BZs5YQjIJ&q=85&s=bb91fc2004a8297aa26a886002fc20f1" alt="Screenshot of the FetchingCapturedData activity in Pega, showing Step 8 labeled ERR with the Page-Set-Messages method and the Message parameter set to @unescapeHTML(@getWorstMessageName(tools))." width="1130" height="238" data-path="images/flexi-capture/connectors/Pega161.png" />
    </Frame>
  </Step>
</Steps>
