If Condition Node
Route workflow execution along a true or false path based on a dynamic expression evaluation.
Key Capabilities
- Evaluates any valid JavaScript expression using the Jint engine — including comparisons, logical operators, string methods, and arithmetic.
- Full access to workflow variables, node outputs, and execution context via
$var,$ctx, and$inputdirectives. - Two deterministic output ports: true and false — exactly one fires per execution, guaranteeing clean branching.
- Supports complex multi-part expressions with logical combinators (
&&,||,!) for compound conditions. - Integrates with
IExpressionEvaluator— the same evaluation engine used throughout BizFirstAI, ensuring consistent variable resolution. - Handles null-safe comparisons gracefully — falsy evaluation on null or undefined values prevents runtime errors.
- No iteration overhead — executes in constant time regardless of data size, keeping workflow performance optimal.
Business Benefits
Business workflows rarely follow a single linear path. Customer orders differ in value, status, and region. Employees have different approval thresholds. Documents require different handling based on type and content. The If Condition node provides the fundamental mechanism to encode these business rules directly into your workflow graph, replacing complex code with a single readable expression.
By separating decision logic into a dedicated node, your workflow becomes self-documenting. Any team member reviewing the workflow can see exactly what condition drives a branch without reading embedded code. This also makes it easy to update business rules — change the expression string in the node's configuration, and the logic update is immediately reflected across every workflow run.
The If Condition node eliminates the need for downstream error handling for many common validation scenarios. Instead of catching exceptions when a value is missing or out of range, you route those cases explicitly to the false branch where they can be handled gracefully — with user notifications, fallback actions, or logging — without interrupting the primary happy-path flow.
Organisations that adopt expression-driven branching consistently see a reduction in workflow exceptions and manual intervention tickets, because edge cases that were previously unhandled are now explicitly routed to appropriate remediation steps.
Use Cases
Route High-Value Orders to Manual Approval
When an order exceeds a configured monetary threshold (e.g., $10,000), route execution to an approval workflow that notifies a manager and pauses for sign-off. Orders below the threshold proceed directly to automated fulfilment, reducing bottlenecks on the approval team while maintaining oversight on large transactions.
Skip Notifications for Opted-Out Users
Before sending email or SMS notifications, check whether the user has opted out of communications. If the user.notifications_enabled flag is false, route to the false branch which skips the notification step entirely — ensuring GDPR and preference compliance without adding conditional logic inside the notification node itself.
Route by Customer Tier for Pricing Logic
Apply premium pricing rules for Gold or Platinum tier customers while standard rules apply to others. The condition $ctx.customer.tier === 'gold' || $ctx.customer.tier === 'platinum' cleanly separates the two pricing paths, making the business rule explicit and auditable.
Apply Conditional Discounts
In e-commerce checkout workflows, check whether a discount code has been applied and is valid before calculating the final order total. Route to the discount calculation branch only when the condition is satisfied, otherwise proceed directly to the standard pricing path.
Validate Data Before Processing
Verify that incoming webhook payload contains all required fields before passing data to downstream processing nodes. If $input.order_id != null && $input.customer_id != null is false, route to an error response node that returns a structured validation error to the caller rather than allowing a malformed record to propagate.
In This Guide
Configuration
Learn how to write the condition expression, available variables, and expression syntax supported by the Jint evaluator.
Input & Output
Understand the true and false output ports, what data is available on each port, and how results flow to downstream nodes.
Examples
Real-world configuration examples covering order routing, data validation, feature flags, and multi-condition logic.