Logic Composer
Decision tree
Ask one question at a time and follow the matching branch until you reach an outcome.
A decision tree models a decision the way people often explain it: ask a question, and depending on the answer, ask the next question or give the answer. Use a tree when different cases need different questions. For example, enterprise customers need a risk check before approval, while small orders do not. When every case asks the same questions, a decision table is usually easier to read.
Parts of a decision tree
Section titled “Parts of a decision tree”| Part | Where you define it | What it is |
|---|---|---|
| Decisions | Decisions tab | The questions the tree can ask. Each has a Name, a Type and an Expression that works out the value, for example Quote.totalamount. |
| Outputs | Output tab | The values the tree returns, each with a name and a type. An output can be a list. |
| Decision cards | Decision Tree tab | A point in the tree where a decision is asked. |
| Branches | Decision Tree tab | The paths out of a decision card. Each branch shows its condition as a chip, such as > 50000. A branch with no condition is the default. |
| Outcome nodes | Decision Tree tab | The end of a path. Each sets the values of the outputs. |
Build a decision tree
Section titled “Build a decision tree”- Create a logic block and choose the Decision tree card. See Create a logic block.
- Add the inputs on the Input tab, and rows or queries on the Data tab.
- Add a decision for each question the tree can ask.
- Add an outcome for each value the tree returns.
- Start the tree: select Choose first decision.
- Under each answer, add another decision or an outcome. When you add a decision to the tree you can reuse an Existing Decision or create a New Decision.
- Give every decision card a default branch (no condition), or make sure its branches cover every value.
- Save, then select Run to test each path.
Work with the canvas
Section titled “Work with the canvas”- Decision cards are white, outcome nodes are light orange, and open branches that still need a decision or outcome show as dashed placeholders.
- Hover over a card, branch or node to see its actions.
- Drag the background to pan. Use Zoom in, Zoom out and Reset zoom to fit large trees. Expand gives the canvas the whole window.
- Deleting a decision from the Decisions tab removes its nodes from the tree, and deleting an output removes it from every outcome node. The editor asks you to confirm first.
How it behaves
Section titled “How it behaves”- Start at the first decision. The tree works out that decision’s value and checks its branches in order.
- The first branch whose condition holds is followed. A branch with no condition is the default and is taken when no other branch matches.
- Continue until an outcome. The outcome node’s output values are returned.
- No matching branch is an error. If a decision has no matching branch and no default, the run fails with “Decision tree evaluation failed to reach a decision.” Give each decision a default branch.
- Comparisons follow the expression rules, including empty numbers counting as 0. See Empty values.
Example: quote approval routing
Section titled “Example: quote approval routing”Inputs: QuoteId (Lookup to Quote)
Data: the quote and its customer account
Decisions: Segment = Account.customertypecode, Amount = Quote.totalamount, Discount = Quote.discountpercentage
Outputs: Approver (Text), ApprovalDays (Whole Number)
flowchart TD
S{Segment} -->|Enterprise| A{Amount}
S -->|default| D{Discount}
A -->|> 50000| O1[Sales Director<br/>3 days]
A -->|default| O2[Account Manager<br/>2 days]
D -->|> 15| O3[Sales Manager<br/>2 days]
D -->|default| O4[No approval<br/>0 days]
An enterprise quote of 80,000 goes Segment → Amount → Sales Director, 3 days. A partner quote with a 20% discount goes Segment → Discount → Sales Manager, 2 days. Different segments ask different questions, which a decision table could not express as compactly.