Skip to main content

What is a Decision Node?​

Have you ever felt the need to show different screens to the user depending on the work progress without the user specifically choosing it? You can now do that in ERPLite using the Decision Node. Decision nodes help users to navigate to different screens programmatically through a simple if-else method. For Example : A Particular agent has met an appointed customer and needs to enter it in the designated app. The app will prompt two possible options : “Met” or “Not Met”. He will click on the “Met” Option. The agent will now be prompted to the “Congratulations, keep it up!” screen. Had the agent not met the customer and clicked on the “Not Met” Option, he would have been prompted to the “Uh no, Pending Customer!” Screen. So now, How do we automatically show the right screen to the user, based on the data we have collected? That is where the Decision Node comes into play!

How to use the Decision Node :

  1. Open Your Existing Workflow in which you would like to insert your Decision Node. (Click here to know - How to Create a Workflow)
  2. Click on the “Create Node” Option located on the right portion of the Navigation Bar. It will show you two options - “Step Node” and “Decision Node”. Click on the “Decision Node” Option.
  3. The Decision Node Action Box will Pop up. Create a transition between the Step node to the Decision Node. Similarly, create a transition from the Decision node to the desired Step Nodes. (Click here to know more about Step Nodes)
  4. Click on the “First Switch” option, under the “If” data space. The Tab will open on the right side of your workspace.
  5. Click on the “+Add New” option, which is present alongside the Conditions Drop Down Box. You will be shown two options :
    • Location Check - It identifies whether two specified geo locations are close to one another. The specific distance to check the proximity can be modified. There is no pre-specified distance. A good example where you can use this is when you want to make sure the user is at a given location ( at or near the customer’s location).
    • Expression Check - This is a simple logic based check. The User can enter the logic based code in the low-code environment. The code can be simple (for example - to check whether the two values are the same) or it can be a complex code (For example- To check whether the delivery boy has reached the location between 12pm to 1pm).
  6. You can add multiple if-conditions if you wish to do so. For that you must click on the “Add Switch” Button under the if-description box and write your desired logic for the same.
  7. The logic is ready. You can check it by implementing it on your app.

Condition Types

Location Check

Verifies if two locations are within a specified distance of each other.
ConfigurationDescription
Location 1First location (e.g., user’s current location)
Location 2Second location (e.g., customer address)
DistanceMaximum allowed distance in meters

Expression Check

Uses JavaScript to evaluate conditions.
// Simple comparison
task.data.status === "Approved"

// Multiple conditions
task.data.amount > 100 && task.data.is_verified === true

// Check user role
loggedInUser.role === "Manager"

Multiple Conditions (Switches)

You can add multiple conditions (switches) to handle different scenarios:
Decision Node
├── If: task.data.priority === "High" → Urgent Screen
├── If: task.data.priority === "Medium" → Normal Screen
└── Default → Low Priority Screen
Conditions are evaluated in order. The first matching condition determines the path.

For AI Agents

Decision Node Structure

interface DecisionNode {
  nodeId: string;
  type: 'DECISION';
  name: string;
  switches: Switch[];
  defaultTransition?: string;
}

interface Switch {
  switchId: string;
  condition: Condition;
  targetNodeId: string;
}

interface Condition {
  type: 'LOCATION_CHECK' | 'EXPRESSION';
  config: LocationCheckConfig | ExpressionConfig;
}

interface LocationCheckConfig {
  location1: string;  // Data field path
  location2: string;  // Data field path
  maxDistanceMeters: number;
}

interface ExpressionConfig {
  expression: string;  // JavaScript expression
}

UI Components

ComponentLocationPurpose
DecisionNodeEditor/src/views/workflows/nodes/DecisionNode/Decision node configuration
SwitchEditor/src/views/workflows/nodes/DecisionNode/Switch/Condition configuration
ExpressionBuilder/src/components/LowCode/ExpressionBuilder/Expression editor

Event Tracking

// Decision node events
WorkflowEvents.DECISION_NODE_CREATED
WorkflowEvents.DECISION_NODE_UPDATED
WorkflowEvents.DECISION_SWITCH_ADDED
TaskEvents.DECISION_EVALUATED