Skip to Content
trumpetdocs

Branch

Select the first matching conditional path, with an else path when no condition matches.

Purpose

Gate actions by event values, lookup results, or completion status.

Conditions

  • Default: Add only for a user-requested decision, alternative path, or intentional skip.
  • Already handled: Dependencies already enforce upstream completion; actions validate required inputs and resource permissions. A branch does not pass data to consumers.
  • Use a condition when: The user specifies values such as a stage, amount threshold, form answer, owner-only scope, or a missing-result alternative. Reuse an existing qualifying path.
  • Failure behavior: A non-matching condition skips its dependent path and can leave the run Completed, not Failed. Missing mapped fields or invalid comparisons can fail before routing.

Guidance

  • Case keys must be unique. The final else case omits condition; path labels do not configure conditions.
  • Derive the required input_mapping keys from every { kind: "input", key } operand, including nested conditions. Map each key to its original trigger or upstream step source.
  • Numeric comparisons require numbers; check nullable values before comparing and confirm optional source availability. Existence checks still require right in the saved shape; use a null literal.
  • Combine nullable numeric checks in one ordered AND condition: amount exists, then amount greater_than the threshold. String equality to a concrete value or contains needs no preliminary null check. Test a boolean lookup flag with equals true; exists also matches false. Reuse a qualifying upstream path rather than adding another conditional.
  • An existence condition can guard a present nullable value. Mapping an absent field fails before condition evaluation; a branch cannot recover an omitted required source.
  • selected_branch is used for internal routing. Not selectable as a downstream variable; later steps must map the original trigger or earlier step directly.