Branch
Nodo de flujo
branchlogicSplits the run into paths. The first path whose condition holds runs; otherwise the "otherwise" path, if there is one.
De un vistazo
| Propiedad | Valor |
|---|---|
| Node field | branch (set instead of stepRef on a FlowNode) |
| Side effects | no |
A FlowNode sets exactly one of stepRef, branch, filter, forEach, wait and approval.
The value is a list; each item has the settings below.
Conditions use the expression language: a field, an operator and a value, as in {field: details.total, op: gte, value: 10000}.
Ajustes
El valor del campo del nodo, con estos ajustes.
| Ajuste | Tipo | Valor por defecto | Descripción |
|---|---|---|---|
when | object | - | When is the case's condition. It may be left out while the case is not set up yet: the webhook then reports the Flow incomplete, so it can be saved suspended as a draft. When present, its field is strict. |
when.expr | string | - | Expr is the condition as text. Every field in it is a node or trigger upstream on every path to this one, and one of its outputs. |
when.field | string | - | Field is <nodeId>.<field>: a node or trigger upstream on every path to this one, and one of its outputs. |
when.op | string | - | |
nextobligatorio | list of string | - |
El JSON Schema completo de estos ajustes: branch.schema.json.
Úsalo en un flujo
flow.yaml
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
name: my-email-forward
namespace: tenant-acme
spec:
classRef: {name: email-forward}
config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: branch-example
namespace: tenant-acme
spec:
displayName: "Branch"
triggers:
- id: start
ref: {name: email-arrives}
connectorRef: {name: my-email-forward}
next: [text]
nodes:
- id: text
stepRef: {name: read-text}
next: [details]
- id: details
stepRef: {name: chat-agent}
config:
instructions: Find the total in the invoice.
fields: [{name: total, type: money}]
files: {mode: ifNoText}
next: [route]
- id: route
branch:
- when: {field: details.total, op: gte, value: 10000}
next: [large]
branchDefault: [small]
- id: large
stepRef: {name: notify-in-app}
config:
to: admins
title: A large invoice came in
body: "Total: {details.total}"
- id: small
stepRef: {name: save-file}
config: {destination: lumen}
¿Te ha resultado útil esta página?