Skip to content

Merge node

The Merge node fans several branches back into one variable. After an If or Switch splits your flow — each branch writing its own result — Merge gives the downstream path a single, predictable place to read from, so you don't have to duplicate the rest of the graph per branch.

Component id: flowrunner/merge.

How it works

Merge reads a list of sources (dotted references) and combines them into a result variable using one of two strategies:

  • First defined (first) — walks the sources in order and takes the first one that has a value (not undefined/null). Use this to coalesce divergent branches: branch A writes premiumPlan, branch B writes freePlan, and Merge collapses whichever ran into plan.
  • Combine (combine) — shallow-merges every source that resolves to an object into a single object. Later sources win on key conflicts.

How the result is stored

  • First defined: if the picked value is a plain object it's stored as-is (read result.field); a scalar is wrapped as { value } (read result.value).
  • Combine: the merged object is stored as-is — read result.field.

Config

FieldRequiredDescription
sourcesYesA list of dotted references (one per line in the inspector), e.g. premiumPlan and freePlan.
strategyNo (default first)first (coalesce to the first defined source) or combine (shallow-merge objects).
resultVarNo (default merged)The variable the merged value is written to.

Ports

Merge has a single next port.

NOTE

The engine runs a convergent node once, on the first branch to reach it — so a Merge downstream of an If/Switch fires a single time. That's why first reads whichever branch actually set its variable, rather than trying to collect every branch at once.

Examples

Coalesce two branches into one variable:

text
# branch A (premium):  Set plan-A → premiumPlan
# branch B (free):     Set plan-B → freePlan
Merge  sources: [premiumPlan, freePlan]  strategy: first  resultVar: plan
# → refs.plan = whichever branch ran

Combine partial objects into one:

text
Merge  sources: [contact, address]  strategy: combine  resultVar: profile
# contact = { name }, address = { city } → refs.profile = { name, city }

See also

FlowRunner — the no-code platform for small businesses.