Skip to main content

If / Else ⚖️

Branches workflow execution based on a boolean condition.

Node type: ifElse Category: Flow Control Actor: ifElse (1 thread)


Description

The If/Else node evaluates a JUEL (Java Unified Expression Language) expression and routes execution down the trueFlow or falseFlow path depending on the result.

The condition expression is configured on the outgoing connection (link), not on the node itself. The If/Else node simply branches; each outgoing link carries its own condition.


Properties

The If/Else node itself has no configurable properties in the properties panel. Conditions are set on the outgoing trueFlow and falseFlow links.


Condition Expressions

Conditions are JUEL expressions written on the outgoing connections. They must:

  • Be wrapped in ${...}
  • Evaluate to true or false
OperatorExampleMeaning
==${status == 'active'}String equality
!=${classification != 'billing'}Inequality
>, <${orderTotal > 500}Numeric comparison
>=, <=${score >= 90}Numeric comparison
&&${isPremium == 'true' && tier == 'gold'}Logical AND
||${isNew == 'true' || isGuest == 'true'}Logical OR
!${!isCancelled}Negation
empty${empty customerEmail}Null/empty check
String methods${name.startsWith('J')}Java String methods

Configuring Conditions in the Designer

  1. Draw a connection from the If/Else node to the next node
  2. Select the connection (click on it)
  3. In the Properties Panel, set the Connection Type to trueFlow or falseFlow
  4. Enter the Condition Expression (e.g., ${classification == 'billing'})

The trueFlow link should carry the condition that must be true to follow that path. The falseFlow link is the else branch.


Common Patterns

String Equality Check

trueFlow condition: ${classification == 'billing'}
falseFlow condition: ${classification != 'billing'}

Or simply leave the falseFlow without a condition — it is taken when trueFlow is not taken.

Boolean Check

trueFlow condition: ${isApproved == 'true'}
falseFlow condition: ${isApproved == 'false'}
note

All workflow variables are strings internally. Compare boolean-like values as strings: 'true' / 'false'.

Numeric Threshold

trueFlow condition: ${orderTotal > 1000}
falseFlow condition: ${orderTotal <= 1000}

Null / Empty Check

trueFlow condition: ${!empty customerEmail}
falseFlow condition: ${empty customerEmail}

Compound Conditions

trueFlow condition: ${isPremium == 'true' && orderCount > 10}
falseFlow condition: ${isPremium != 'true' || orderCount <= 10}

Multi-Branch Decisions

For more than two paths, chain If/Else nodes:

[If/Else: billing?]
↓ trueFlow
[Handle Billing]
↓ falseFlow
[If/Else: technical?]
↓ trueFlow
[Handle Technical]
↓ falseFlow
[Handle General]

Or use a Split node with exclusive mode if you have many parallel paths to evaluate.


Connections

ConnectionDescription
sequenceFlow (incoming)Any node connects here
trueFlow (outgoing)Taken when the condition evaluates to true
falseFlow (outgoing)Taken when the condition evaluates to false (or when trueFlow is not taken)

Both trueFlow and falseFlow are required for a well-formed If/Else. A missing branch may cause the execution path to terminate unexpectedly.


Expression Language Reference

JUEL supports the full Java EL expression syntax:

${varName}                    → value of varName
${varName.property} → property access
${varName == 'value'} → equality comparison
${varName matches '\\d+'} → regex match
${fn:contains(varName, 'sub')} → string contains (with fn namespace)
${fn:length(varName)} → string/collection length

Available functions depend on the EL context configured in the engine. Standard arithmetic and string comparison operators are always available.


Error Handling

ScenarioBehavior
Expression evaluates to trueTakes trueFlow path
Expression evaluates to falseTakes falseFlow path
Expression throws evaluation errorProcess instance fails with CONDITION_ERROR
Variable referenced in condition is nullempty check returns true; comparison may throw — use null-safe patterns

Best Practices

  • Always define both trueFlow and falseFlow connections
  • Use empty to check for null variables before comparing: ${!empty status && status == 'active'}
  • Quote string values: 'active' not active
  • For complex branching with 3+ paths, consider a Script Task to reduce complexity
  • Add descriptive labels to connections (shown in the designer) to make the flow readable