Decision Tree
Last updated
Last updated
DecisionTree is a powerful rule type in Nected that enables you to create complex branching logic for decision-making scenarios. Unlike linear rule evaluation, DecisionTree allows you to build hierarchical decision structures with multiple paths and outcomes based on various conditions. By utilizing switch blocks as decision nodes, you can construct multi-level trees that evaluate input attributes and route decisions through the most appropriate path based on your defined criteria.
To create the DecisionTree, just follow these simple steps:
Before configuring your decision logic, you need to define the input attributes that will drive your DecisionTree. These attributes serve as the data points your conditions will evaluate against.
Input attributes can be sourced from two primary categories:
1. Static Values
Direct static values defined in the trigger node
Global variables are accessible across your rule
Values from the Attribute Library for standardized data points
2. Dynamic Values
Data fetched from (PostgreSQL, MongoDB, Google Sheets, and other supported databases)
Values retrieved through REST API nodes for real-time external data
To add input attributes:
Navigate to the Input Attributes section
Click "Add Attribute."
Define the attribute name, data type, and source
Configure the source settings based on whether you're using static or dynamic values
Once you've defined your input attributes, you can begin building your decision tree logic. The DecisionTree utilizes switch blocks and variable management to create sophisticated branching decision paths.
To add output values:
Click the + icon in the rule designer
Select "Set Variable" from the node list
Define your output variables:
Variable name: Create meaningful names for your outputs (e.g., "approvedAmount", "riskScore", "eligibilityStatus")
Initial value: Set default values that can be updated later based on decision paths
Value source: Use static values, data from DB nodes, or values from input attributes
These output values will be available throughout your DecisionTree and can be updated at any point based on your business logic.
With your output values initialized, you can now build the decision logic using switch blocks:
Click on the + icon in the rule designer
The switch block serves as your decision branching mechanism, offering three key components:
The IF path represents your primary condition branch. When configuring an IF path:
Path Name: Enter a descriptive name in the path field to identify this decision branch (as shown in your UI where "Path" appears next to "IF")
Condition Builder: Configure your condition by:
Property: Click the dropdown to select from your defined input attributes (e.g., cusID, creditAppl...)
Operator: Choose the appropriate comparison operator from the dropdown (Exists, Is Null, Equals, Greater than, etc.)
Value: Set the comparison value for your condition in the input field
Advanced Condition Options:
Multiple Conditions: To add additional conditions within the same IF path:
Click the "+ Add Condition" button below your existing conditions
Each new condition will be connected with an AND operator by default
Changing Logical Operators: To switch between AND/OR operators:
Click on the "And" dropdown button between conditions
Select either "And" or "Or" from the dropdown menu
This allows you to create complex logical expressions like "(A AND B) OR C"
Condition Groups: To organize multiple related conditions into groups:
Add multiple conditions first
Click the "+ Convert to group" button that appears next to conditions
This wraps selected conditions in a group, shown with a dotted border
Groups help manage complex logic by visually organizing related conditions
Nested Groups: For even more complex evaluation scenarios:
Within an existing group, click "+ Add Group"
This creates a nested group inside your current group
You can change the logical operator (AND/OR) at the group level using the dropdown
Each group can contain multiple conditions and subgroups
The UI provides visual hierarchy through indentation and borders to clearly show the relationship between conditions, groups, and nested groups.
To handle multiple decision scenarios, you can add ELSE IF paths:
Click "Add ELSE IF" button to create additional conditional branches
Each ELSE IF path provides the same configuration options as the primary IF path:
Custom Path Naming: Enter a descriptive name in the path field
Full Condition Builder: Access the same property, operator, and value selection interface
Multiple Conditions Support: Use the "+ Add Condition" button to add more conditions
AND/OR Operators: Click the logical operator dropdown to switch between AND/OR
Grouping Capabilities: Use "+ Convert to group" and "+ Add Group" for complex logic
You can add as many ELSE IF paths as needed to cover all decision scenarios in your tree. Each path evaluates independently and executes only when its conditions are met and previous conditions have failed.
The DEFAULT path acts as a catch-all branch that executes when none of the defined conditions are satisfied:
Enable/Disable: Use the toggle to activate or deactivate the DEFAULT path
Purpose: Handles edge cases and ensures your DecisionTree always produces an outcome
Optional: You can disable the DEFAULT path if you want the tree to only execute when specific conditions are met
Once done, we can create multi-level decision trees. To do this, follow the steps below:
Nested Decisions: Within each path (IF, ELSE IF, or DEFAULT), you can add additional switch blocks to create deeper decision levels
Path Continuation: Each decision path can lead to:
Another switch block for further branching
Action nodes for executing specific operations
Response nodes for returning results
After configuring your decision tree structure and managing output values, you need to define how your DecisionTree returns results and performs actions based on the decisions made.
The Response Node defines what data your DecisionTree returns after evaluation. This is where you structure the final output that will be sent back to the calling system or used by subsequent nodes.
To add a Response Node:
At the end of each decision path, click the + icon
Select "Response Node" from the node list
Configure the response structure:
Response Format: Choose between JSON, text, or structured data
Response Data: Map your output variables and any additional data
Include Variables: Select which Set Variables should be included in the response
Add Custom Fields: Include any static or computed values in the response
Structure your response to include:
Decision outcome (which path was taken)
Updated output values from Set Variable nodes
Any relevant input data that should be passed through
Metadata about the decision process if needed
Beyond returning results, your DecisionTree can trigger actions to update systems or invoke external services. Actions are executed when specific decision paths are taken.
To update database records based on your decision:
Within any decision path, click the + icon
Select "DB Node" from the node list
Configure the database action:
Select Database: Choose from your configured database connections
Operation Type: Select INSERT, UPDATE, or MERGE
Target Table: Specify which table to modify
Field Mapping: Map your output values to database columns
Define the query or operation:
For INSERT: Map all required fields for new record creation
For UPDATE: Specify the WHERE clause and fields to update
For MERGE: Define both matching criteria and update/insert logic
To trigger external services or APIs:
Within any decision path, click the + icon
Select "REST API Node" from the node list
Configure the API call:
Method: Choose GET, POST, PUT, PATCH, or DELETE
URL: Enter the API endpoint
Headers: Add any required authentication or content-type headers
Body: For POST/PUT requests, map your output values to the request payload
Set up the request:
Authentication: Configure API keys, Bearer tokens, or Basic auth
Request Body: Use your output variables to construct the payload
Query Parameters: Add any required URL parameters
Error Handling: Define behavior for failed requests
Before publishing your DecisionTree, ensure all components are properly configured and tested. If you're using any draft rules within your DecisionTree logic, make sure to update them to live versions before publishing.
Verify all draft rules are updated to live versions (either the latest live version or a specific live version based on your requirements)
Test all decision paths with representative data
Validate response nodes return expected results
Publish in Production: To publish the DecisionTree directly to production, click the "Publish" button located in the bottom right corner of the rule designer.
Request for Review: If your organization requires approval before publishing, you can assign a reviewer:
Click on "Request for Review" option
Select an approver from your workspace members
Add review notes if necessary
Nected maintains a comprehensive version history for your DecisionTree rules. Each time you edit and re-publish a DecisionTree, a new version is created automatically. This versioning system allows you to track changes and rollback to previous versions when needed.
You can access the Version Control interface through two methods:
Method 1: Environment Tabs
Look at the top bar where you'll see environment tabs (Draft, Staging, Production)
Numbers displayed alongside each environment indicate the total versions available
Click on the respective environment tab to open the Version Control section
For example, "Production (3)" indicates three published versions in production
Method 2: Version Control Icon
Click the version control icon (located next to the settings icon)
This directly opens the Version Control section
View all available versions across different environments
To revert to a previous version of your DecisionTree:
Navigate to the Version Control section using either method above
Locate the version you want to restore
Click the "Rollback" button for that specific version
Confirm the rollback action
Decision Trees can be integrated into various workflows and systems within Nected. The Dependency Mapping feature helps you track where your DecisionTree is being used and what resources it depends on.
Click on the dependency map icon (located below the Version Control icon)
The Dependency Map section will open with two distinct tabs
1. Using Tab This tab displays all the resources that your DecisionTree depends on:
Integrated data sources
Referenced rules or rulesets
Connected workflows
External API dependencies
Database connections used in dynamic value fetching
2. Used By Tab This tab shows where your DecisionTree is being utilized:
Workflows incorporating this DecisionTree
Other rules referencing this DecisionTree
Version information for each usage
Environment details (Production, Staging, etc.)
The dependency information is particularly valuable when planning updates, as it helps ensure changes to your DecisionTree won't unexpectedly impact other parts of your system.
The DecisionTree rule type in Nected provides a robust solution for implementing complex, multi-path decision logic. By combining the flexibility of switch blocks with the power of hierarchical decision structures, you can create sophisticated rules that handle diverse business scenarios efficiently.
With features like version control, dependency mapping, and comprehensive input attribute support, DecisionTree rules are well-suited for applications ranging from risk assessment and pricing calculations to approval workflows and recommendation engines. As you build your decision trees, remember to leverage the visual branching structure to create clear, maintainable, and scalable decision logic that grows with your business needs.
Before creating your decision conditions, you can define output values that will be populated based on your decision logic. The enables you to create and manage these output values dynamically.
Select the from the available node list
Note: When a DecisionTree is submitted for review, only the designated reviewer can publish it to production. Without a review request, you can publish directly using the Publish button. Learn more about the approval process in the documentation.