π² Multi-Path Node
The Multi-Path Node is a type of `condition` node that evaluates multiple filters in sequence. The first filter that evaluates to `true` determines which path (edge) to follow in the diagram.
For more information on JSON logic Click here
This node allows you to build multi-branch conditional logic, where a single node can route to different outcomes based on priority-ordered criteria.
π¦ JSON Representation
π§Ύ Form Data Fields
| Field | Type | Required | Description |
|---|---|---|---|
filters | Array of { id: string, data: object } | β | A list of JSON logic filters. The node evaluates each filter in order and selects the first one that returns true. |
Each filter object must have:
id: A unique string identifier for the filter.data: A JSON Logic object to evaluate.
βοΈ Execution Logic
- Iterate Through Filters:
- Filters are evaluated in the order they are defined in the array.
- Preprocess Fields:
- For each filter: load custom fields, metrics, and targets using
loadUserFieldsandloadMetricAndTargetValues.
- Evaluate Logic:
- If the JSON logic expression (
filter.data) returnstrue, the index of the filter is returned and used to follow the corresponding edge in the diagram.
- No Match:
- If no filter returns
true, the function returns-1. This typically results in no edge being followed (or an error if all branches are required).
π’ Output
- Returns the index of the first filter (starting at
0) that evaluates totrue. - This index corresponds to the correct edge to follow in the node's connections.
β Validation Rules
| Rule | Description |
|---|---|
| Filters must be defined | formData.filters must exist and be an array. |
| Each filter must contain logic | Each filter.data must be a valid, non-empty JSON object. |
| Each filter must have values | The logic must include at least one actual condition with non-empty value arrays. |
π§ͺ Example Logic
- If the deal is
"Won"and amount > 10,000 β path 0. - If the deal stage is
"Closed"β path 1. - Otherwise β
-1(no match).