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

# Conditional Logic & Routing

> Create dynamic workflows with intelligent branching based on user responses

Create workflows that adapt to user responses by using conditions on connections between entities. Instead of showing the same questions to everyone, your flows can branch and show relevant content based on what users have entered.

> [!NOTE]
>
> **Smart Connections**
> Connections between entities can include conditions that control when users follow specific paths, creating personalized experiences within a single workflow.

## How It Works

### Connections (Edges)

Connections represent the pathways between components in your flow. They link entities and determine the sequence in which components appear to users during a conversation.

> [card] Linear Flow
>
> **Simple Sequence**
> Connect entities in order for straightforward, step-by-step workflows

> [card] Branching Flow
>
> **Multiple Paths**
> A single entity can connect to multiple destinations with different conditions

### Adding Conditions

Each connection can include a condition. When a condition is applied to a connection, that pathway will only be followed if the condition evaluates as true, enabling personalized conversation experiences based on user responses.

**Example:**

* Age question connects to two different paths
* If Age \< 25 → Show student insurance options
* If Age ≥ 25 → Show standard insurance options

***

## Available Conditions

Based on the Wizflow platform, these condition types are available:

> [tab] Value Checks
>
> > [card] eq (equals)
> >
> > Check if a response equals a specific value
>
> > [card] cmp (compare)
> >
> > Compare values (greater than, less than, etc.)
>
> > [card] range
> >
> > Check if a value falls within a specified range
>
> > [card] has
> >
> > Verify if an entity has a specific value or property

> [tab] Data Existence
>
> > [card] resource
> >
> > Check if a data resource or entity exists
>
> > [card] userExists
> >
> > Validate if a user record exists in the system
>
> > [card] houseExists
> >
> > Check if house/property data exists (Danish context)
>
> > [card] pensionExists
> >
> > Validate if pension data exists for the user

> [tab] Multiple Choice
>
> > [card] mcqHas
> >
> > Check if multiple choice question has specific selection
>
> > [card] count
> >
> > Count items/records and validate against thresholds

> [tab] Boolean Logic
>
> > [card] boolean
> >
> > Direct boolean value check (true/false)
>
> > [card] truthy
> >
> > Check if value evaluates to true (non-empty, non-zero)
>
> > [card] falsy
> >
> > Check if value evaluates to false (empty, zero, null)

> [tab] System State
>
> > [card] isUserAuthenticated
> >
> > Check if user is logged in/authenticated
>
> > [card] minWidth
> >
> > Check if screen meets minimum width (responsive design)
>
> > [card] isInAppBrowser
> >
> > Detect if user is in mobile app browser vs regular browser
>
> > [card] isFeatureFlagProtected
> >
> > Check if feature is behind a feature flag

***

## Simple Examples

### Basic Age Routing

```
Age Question: "How old are you?"
├─ If age < 18 → "You must be 18 or older"
├─ If age >= 18 AND age <= 65 → Standard Application
└─ If age > 65 → Senior Application with Additional Questions
```

### Choice-Based Routing

```
Insurance Type Question: "What type of insurance do you need?"
├─ If choice = "Life Insurance" → Life Insurance Questions
├─ If choice = "Home Insurance" → Property Details
└─ If choice = "Auto Insurance" → Vehicle Information
```

### Danish Services Integration

```
User Authentication Check
├─ If isUserAuthenticated = true → Skip basic info, load from systems
└─ If isUserAuthenticated = false → Collect basic information manually

Property Information
├─ If houseExists = true → Load property details automatically  
└─ If houseExists = false → Manual property entry form
```

***

## Building Conditional Flows

**1. Plan Your Branches**

Identify where your workflow needs to split based on different user responses or data

**2. Connect Entities**

Create connections between entities in the visual flow builder

**3. Add Conditions**

Click on connections to add conditions that determine when users follow each path

**4. Test Your Logic**

Use the preview feature to test different user paths through your workflow

***

## Best Practices

> [card] Keep It Simple
>
> Start with basic conditions before building complex branching logic

> [card] Test All Paths
>
> Make sure every possible user journey has a valid path through your flow

> [card] Provide Fallbacks
>
> Always include default paths for unexpected conditions or missing data

> [card] Use Clear Logic
>
> Make your conditions easy to understand and maintain for your team

***

## Common Use Cases

> [accordion] Skip Irrelevant Questions
>
> Show only questions that apply to each user based on their previous answers

> [accordion] Different Application Processes
>
> Route users through different approval or verification processes based on their profile

> [accordion] Personalized Information
>
> Display relevant product information or advice based on user characteristics

> [accordion] Progressive Disclosure
>
> Reveal more detailed questions only when needed based on initial responses

***

## Related Documentation

* [Entities Overview](https://docs.wizflow.io/features/entities-overview.md) - Understanding the components you can connect
* [Flow Builder Basics](https://docs.wizflow.io/features/flow-builder-basics.md) - Creating and connecting entities


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.