Skip to main content

Logic XOR Component

Use the Logic XOR (Exclusive OR) component to verify that exactly one of multiple conditions is met. This component is essential for scenarios where choices are mutually exclusive, ensuring that only one option is valid at a time.

Why this matters

Many business rules require mutual exclusivity. The Logic XOR component enforces this by confirming that one, and only one, condition from a set is true. It's perfect for tasks like "allow a user to sign in with a username OR a phone number, but not both" or "process a transaction if it is marked as 'new' OR 'updated', but not neither or both."

What You’ll Configure

Step 1: Understand the Logic

The component takes multiple inputs and provides two outputs: Verified and Unverified. The Verified path is triggered only if exactly one input is true. In all other cases (zero true inputs, or more than one true input), the Unverified path is triggered.

In this context:

  • True: Any input that has a value (e.g., a non-empty string, any number, the boolean true, an object, an array).
  • False: Any input that is empty, null, undefined, or the boolean false.

Operational Rules

Input 1Input 2Verified Path (Outputs true)Unverified Path (Outputs true)
TrueTrueInactiveActive
TrueFalseActiveInactive
FalseTrueActiveInactive
FalseFalseInactiveActive

Step 2: Provide Inputs

You can add two or more inputs to the component, each representing a condition to be checked for mutual exclusivity.

ActionDescription
Add InputClick the + icon to add a new input field. Give it a descriptive name that reflects the condition you are checking.

Step 3: Handle the Outputs

The component has two output branches, allowing you to direct the workflow based on whether exactly one condition was met.

OutputDescription
VerifiedThis path executes if one and only one of the inputs evaluates to true.
UnverifiedThis path executes if zero inputs are true, or if more than one input is true.
Branching Your Workflow

Connect the Verified output to the main success path of your workflow. Connect the Unverified output to a path that handles the error case, such as asking the user to correct their input or logging an invalid state.

Best Practices

  • Enforce Mutual Exclusivity: This is the primary use case. Use it to ensure a user has selected only one option from a list, or that a data record exists in only one of several possible states.
  • Validate Configuration: Check that a system is configured with exactly one of several possible settings enabled.
  • Distinguish from OR: Do not confuse XOR with OR. OR succeeds if at least one condition is true. XOR succeeds only if exactly one condition is true.

Troubleshooting Tips

If your logic isn't branching as expected...
  • The Unverified Path is Taken: Remember that Unverified triggers in two cases: when no inputs are true, AND when more than one input is true. Use the Debug panel to inspect your inputs and see which case is occurring.
  • Check Your "False" Values: An input you expect to be false might contain an unexpected value (like the string "false"), which evaluates to true, potentially causing more than one input to be true at once.
  • Inputs are Not Truly Exclusive: If the Unverified path is frequently taken because multiple inputs are true, it may indicate a flaw in upstream logic that is allowing a non-exclusive state to occur.

What to Try Next

  • Create a sign-up flow where a user must provide either an email or a phone number, but not both, using Logic XOR to validate their input.
  • In a state machine, use Logic XOR to confirm that an item is in exactly one state (e.g., "Pending" XOR "Complete" XOR "Failed").
  • Combine with other logic components to build complex validation rules, such as "(A XOR B is true) AND C is also true."