# Condition Stage

The **Condition stage** in AiFlo is used to control the execution flow of your workflow based on a specified condition. If the condition evaluates to **True**, the stages inside the Condition block are executed. If it evaluates to **False**, those stages are skipped.

This is useful for creating dynamic workflows where certain actions should only run when specific criteria are met.

**Purpose**

* Execute certain stages only when a logical condition is satisfied.
* Avoid unnecessary processing for records that don’t meet defined criteria.
* Support decision-making within workflows.

**Condition Stage – Configuration**

**Step 1. Add Condition Stage**

* Drag and drop the **Condition** stage into your workflow.

**Step 2 – Define Condition Expression**

The Condition Builder allows you to define a logical expression that determines whether the next set of stages will be executed.

Condition Builder Components:

1. Logical Operator
   * AND – All conditions must be true.
   * OR – At least one condition must be true.
2. Select Field
   * Shows all previous workflow variables.
3. Select Condition
   * Available options depend on field type:

| **Field Type**                                                           | **Supported Conditions**                                                        |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| Calculate / Date / Number / Decimal                                      | Equals, Not Equal, Greater Than, Less Than, Greater Than Equal, Less Than Equal |
| Checkbox                                                                 | Equals, Not Equal                                                               |
| Email, Select, User or Group, Single Line, Lookup, Variable, Multiselect | Equals, Not Equal, Contains                                                     |

**Steps 3- Select Value**

* Options depend on field type

Field Behavior by Type:

A. Supports Custom & Variable Value

* Field Types:
  * Single Line
  * Multi Line
  * Email
  * Checkbox
  * Lookup
  * Multiselect
  * Select
  * Attachment
  * User or Group
  * Hyperlink
  * Location

Value Options:

* Custom: Manual input (e.g., Name → Custom → "Raaghav").
* Variable:
* Workflow variable reference (e.g., ${Variable:CandidateName}).
* For record/records type variables, you can reference a specific field:

${Variable:VariableName:FieldName}

B. Supports Custom, Calculated & Variable Value

* Field Types:
  * Decimal
  * Number
  * Date

Value Options:

* Custom: Manual numeric/date input (e.g., 200.5, 2025-01-01).
* Calculated: Use an expression or formula (e.g., \<TODAY>\<PLUS>2).

Variable: Workflow variable reference (${Variable:VariableName},

e.g. ${Variable:Candidate\_Name}).

**Step 5 – Add Nested Stages**

* The stages placed inside the “True” branch will run **only if the condition evaluates to true**.
* You can also add stages to the “False” branch, which will run if the condition is false.
* Inside either branch, all General stages and AI stages can be used.
* Example:
  * Update Record
  * Send Email
  * AI Stage
  * Add Record

**Execution Flow**

1. Evaluate the given condition (boolean expression).
2. If the condition is True → run all nested stages in the “True” branch sequentially.
3. If the condition is False → run all nested stages in the “False” branch sequentially (if any), otherwise skip.
4. Continue workflow execution after the Condition stage.

**Real-Time Example**

**Scenario:**\
You want the flow to send a *Thank You* email only if the user’s country is India.

Condition Expression:

* Select Variable: ${Variable:Country}
* Operator: Equals
* Value: India

**Flow Result:**

* If Country = India → Send Email stage executes.
* If Country ≠ India → Email stage is skipped.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aiflo.app/web-workflow/condition-stage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
