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

# Sample Process

> Import and run the InvoiceWorkflowSample flow to see how the ABBYY Vantage connector for Microsoft Power Automate starts a transaction, polls for completion, and extracts field results.

The connector download includes `InvoiceWorkflowSample.zip`, a sample flow that demonstrates an end-to-end invoice processing scenario: a user uploads an invoice, ABBYY Vantage extracts its fields, and the flow collects the extracted invoice numbers.

<Note>
  Before importing the sample, complete the steps in the [connector guide](/vantage/connectors/ms-powerautomate/guide) to install the ABBYY Vantage custom connector and create a connection.
</Note>

## What the sample demonstrates

The flow is triggered manually and prompts for a file to upload. It then walks through the typical lifecycle of a Vantage transaction:

<Steps>
  <Step title="Start a transaction">
    The **Starts processing of the files in new transaction** action sends the uploaded file to ABBYY Vantage, using a `skillId` to specify which skill processes the document.
  </Step>

  <Step title="Poll for completion">
    A **Do until** loop calls **Gets transaction info** every 10 seconds and checks the transaction status. The loop ends once the status is `Processed`, `Failed`, or `Canceled`, or after 60 iterations (up to 1 hour).
  </Step>

  <Step title="Handle the result">
    A **Switch** action branches on the final transaction status:

    * **Failed**: The sample leaves this branch empty as a placeholder for your own error handling.
    * **Default (success)**: The flow filters the transaction's result files for the `FieldsJson` file type, then loops through each match.
  </Step>

  <Step title="Extract field values">
    For each `FieldsJson` result file, the flow calls **Downloads the result files**, parses the JSON with a **Parse JSON** action, and appends the value of the **Invoice Number** field to an array variable named `invoiceNumberArray`.
  </Step>
</Steps>

This pattern — start a transaction, poll until it finishes, then download and parse the field results — is the basis for most flows you build with the connector.

## Import the sample

1. In [Power Automate](https://make.powerautomate.com), select **My flows** on the left navigation pane.

2. Select the down arrow next to **Import**, then select **Import Package (Legacy)**.

3. Select **Upload**, choose `InvoiceWorkflowSample.zip`, and select **Open**.

4. Once the package details load, configure the related resources:
   * For the **Vantage 3 Test** API resource, set **Import Setup** to **Select during import** and choose your ABBYY Vantage custom connector.
   * For the **ABBYY Vantage** connection resource, set **Import Setup** to **Select during import** and choose your ABBYY Vantage connection.

5. Select **Save**.

6. Once all required resources are configured, select **Import**.

7. Open the imported flow and turn it on.

<Note>
  The sample's **Starts processing of the files in new transaction** action references a `skillId` from the tenant it was exported from. Open the flow, edit that action, and select a skill from your own tenant before running it.
</Note>

## Run the sample

Open the imported flow and select **Test** > **Manually** > **Test** to run it. When prompted, upload an invoice file (PDF or image). After the run finishes, check the **invoiceNumberArray** variable in the run history to see the invoice numbers extracted from the document.

## Next Steps

View the [release notes](/vantage/connectors/ms-powerautomate/release-notes) for the Microsoft Power Automate connector.
