> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invopop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow conditions

> Configure a workflow in Invopop to process documents.

Conditions create blocks that execute when a given *status* and *code* (optional) match the response of a workflow step. There are two status signals (`OK` and `KO`) plus `Any`, which matches regardless of the status.

* **OK**: when a workflow step completes as expected.
* **KO**: when there was an error in the step's execution.
* **Any**: will match both `OK` and `KO`.

Codes are generally text or numbers returned by providers. Only some steps will return codes along with their status signals. For example, the *Send VERI\*FACTU (Spain)* step will return the error code as [specified by the AEAT](https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/errores.properties) along with the `KO` status signal. Since GOBL already handles many of the validations in tax authorities lists, we recommend only implementing conditions which happen in your workflow with certain regularity and which should be handled automatically.

As an example, we will handle the case where a supplier is not registered in the taxpayer census by the AEAT:

<Steps>
  <Step title="Add a condition on the step">
    On the desired step, click on the menu button `...` and select **Add condition**.

    <Frame>
      <img src="https://mintcdn.com/invopop/gppDYSnFxKXpVvfp/assets/guides/workflow-add-condition.png?fit=max&auto=format&n=gppDYSnFxKXpVvfp&q=85&s=63fcf8884e4f75550fa05a70c43416e9" width="100%" alt="Add condition" noZoom data-path="assets/guides/workflow-add-condition.png" />
    </Frame>
  </Step>

  <Step title="Configure the condition">
    <Frame>
      <img src="https://mintcdn.com/invopop/gppDYSnFxKXpVvfp/assets/guides/workflow-add-condition-match.png?fit=max&auto=format&n=gppDYSnFxKXpVvfp&q=85&s=541ad082b478643dbace2929512414f4" width="100%" alt="Add match conditions" noZoom data-path="assets/guides/workflow-add-condition-match.png" />
    </Frame>

    Configure the matching conditions in the popover:

    1. **Status**: `KO`.
    2. **Code**: `4107` (Tax ID not identified in the taxpayer census).
    3. **End workflow here**: `✔` (the workflow will stop executing after this block).
  </Step>

  <Step title="Add an action to the condition block">
    <Frame>
      <img src="https://mintcdn.com/invopop/gppDYSnFxKXpVvfp/assets/guides/workflow-add-condition-action.png?fit=max&auto=format&n=gppDYSnFxKXpVvfp&q=85&s=f4d4253fadab0e42c4a831d44fd7bacc" width="100%" alt="Add condition action" noZoom data-path="assets/guides/workflow-add-condition-action.png" />
    </Frame>

    Click on "Select an action" and handle the condition as you wish. In this case, we are choosing to send a Slack message (e.g. for manual intervention).
  </Step>
</Steps>

## Related resources

|                |                                                                                                                                                                                                                                                                                    |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Reference  | <Icon icon="code" /> [Create a workflow](/api-ref/transform/workflows/create-a-workflow)<br /><Icon icon="code" /> [Update a workflow](/api-ref/transform/workflows/update-a-workflow)<br /><Icon icon="code" /> [Fetch a workflow](/api-ref/transform/workflows/fetch-a-workflow) |
| Related Guides | <Icon icon="book" /> [Workflows Guide](/guides/workflows)                                                                                                                                                                                                                          |
