Building Conditional (If/Else) Workflows

Updated: 2026-07-02Reading time: 5 min

Add branching logic to automate multi-path decisions, configure compound AND/OR conditions, and merge branches back into a single flow for shared downstream steps.

Why Branching Logic Matters

Real-world business processes are rarely linear. A new support ticket might need to route to the enterprise team if the customer account value exceeds a threshold, to the self-serve team otherwise, and to an escalation queue if the issue has been open for more than 48 hours. Encoding this logic directly in your automation — rather than relying on a human to read and route each ticket — is what transforms a basic notification workflow into a true decision-making system. Cotonity's Condition step evaluates one or more expressions against the live data in your workflow context and directs execution to the appropriate downstream branch. Each condition step can have a 'True' branch, a 'False' branch, and an optional 'Else if' chain for multi-way splits.

Configuring a Condition Step

Drag a Condition step onto your workflow canvas and connect it after the step whose output you want to evaluate. In the condition editor, choose a field from the data context picker — for example, 'trigger.body.deal_value' — select a comparison operator (equals, greater than, contains, matches regex, is empty, and others), and enter the comparison value. For string comparisons, the editor is case-insensitive by default; toggle the case-sensitive switch if your logic requires exact matching. Once you define the condition, you will see two outbound connectors on the step card: the green 'True' path and the grey 'False' path. Drag new steps onto each path to build out the branches. Steps on one branch have no awareness of steps on the other, so you can design each path completely independently.

Compound Conditions with AND / OR Logic

A single comparison is often too blunt for real workflows. Cotonity allows you to combine multiple conditions using AND (all conditions must be true) and OR (at least one condition must be true) operators within a single Condition step. Click the 'Add condition' button to append a second row to the condition editor, then choose AND or OR from the operator dropdown between the rows. You can nest condition groups — for example, '(A AND B) OR C' — by clicking 'Add group'. The condition editor renders the final expression as a plain-English summary below the rule builder so you can verify the logic at a glance before saving. Complex condition groups can always be simplified by chaining multiple condition steps in sequence, which some teams find easier to read in the visual canvas.

Merging Branches Back Together

After your True and False branches perform their respective actions, you often want execution to continue along a single shared path — for example, to log the outcome or update a status field regardless of which branch ran. Use the Merge step to converge two or more branches back into one. Drag the Merge step onto the canvas and connect both branch outputs to it. Steps after the Merge receive the combined data context from whichever branch actually executed, so they can reference the outputs of branch-specific steps via the context picker. If one branch is empty (no steps), the Merge still works correctly — it simply passes through the data from the branch that ran. Avoid deeply nested if/else trees when a single condition with well-named branches will do; flat workflows are far easier to debug.