xFlow
  • Overview
    • Introduction
    • Core Features
    • Architecture
      • High Level Architecture
      • Tech Stack
      • Deployment Flexibility
      • Performance and Scalability
      • Security Compliance
  • Getting Started
    • Installation
    • Quick Start
    • Configuration
  • Core Concepts
    • Serverless Workflow Specification
    • Workflow data handling
    • Workflow Expressions
    • Error handling
    • Input and Output schema definition
    • User Task
    • User Forms
      • Lowcode Form
      • Advanced User Form
    • AI Agents in Enterprise Business Processes
    • Comparisons
      • BPMN2
  • Developer Guide
    • Architecture
    • API Reference
    • Workflow States Reference
      • Event State
      • Operation State
      • Switch State
      • Parallel State
      • Inject State
      • ForEach State
      • Callback State
      • UserTask State
      • AIAgent State
      • AIAgentProxy State
      • UserProxyAgent State
      • AI Outbound Agent State
    • Workflow Functions
      • REST
      • GraphQL
      • Custom
        • Built-in Functions
        • Lowcoder Query Function
      • Function Auth
    • Workflow Secrets
    • Integrations
    • Workflow Modeler
    • Frontend Development
      • Forms
        • Lowcode Form
        • Advanced User Form
    • Serverless Workflow Development
      • Operation State
      • Switch State
      • Parallel State
      • ForEach State
      • Callback State
      • User Task State
    • AI Agent Development
      • AI Agent
        • Predefined LLM
        • LLM Configuration
        • Multi LLM Configuration
        • Chat Memory
        • Tools
        • Data Output
        • Agent Outcomes
      • AI Agent Proxy
        • AI Agents Integration
      • User Proxy Agent
      • xChatBot Integration
  • Examples
    • Basic Examples
    • Advanced Examples
      • Loan Approval Workflow
      • QMS AP Workflow
  • Administration
    • Monitoring and Logging
    • Security
    • Performance Tuning
  • Extensions and Customizations
    • Plugins and Add-ons
  • Troubleshooting
    • Common Issues
    • FAQs
  • Release Notes
    • Version History
    • Upcoming Features
  • Support
    • Contact Information
    • Community
Powered by GitBook
On this page
  • Customer Banking Transactions
  • Customer Application
  • Applicant Processing
  1. Examples

Basic Examples

Simple workflow examples to help new users understand the basic functionality of xFlow, focusing on simple approval and data processing tasks.

Customer Banking Transactions

{
  "id": "bankingtransactions",
  "name": "Customer Banking Transactions Workflow",
  "version": "1.0",
  "specVersion": "0.8",
  "timeouts": {
    "workflowExecTimeout": {
      "duration": "PT1M"
    },
    "actionExecTimeout": "PT10S"
  },
  "autoRetries": true,
  "start": "ProcessTransactions",
  "states": [
    {
      "name": "ProcessTransactions",
      "type": "foreach",
      "inputCollection": "${ .customer.transactions }",
      "iterationParam": "${ .tx }",
      "mode": "parallel",
      "actions": [
        {
          "name": "Processing Action",
          "functionRef": "InvokeBankingService"
        }
      ],
      "end": true
    }
  ],
  "functions": [
    {
      "name": "InvokeBankingService",
      "type": "rest"
    },
    {
      "name": "QueryCustomerName",
      "type": "expression",
      "operation": "${ .customer.name }"
    },
    {
      "name": "QueryCustomerAge",
      "type": "expression",
      "operation": "${ .customer.age }"
    }
  ]
}

```

Customer Application

{
  "id": "customerapplication",
  "name": "Customer Application Workflow",
  "version": "1.0",
  "timeouts": {
    "workflowExecTimeout": {
      "duration": "PT1M"
    },
    "actionExecTimeout": "PT10S"
  },
  "retries": [
    {
      "name": "WorkflowRetries",
      "delay": "PT3S",
      "maxAttempts": 10
    }
  ],
  "states": [
    {
      "name": "NewCustomerApplication",
      "type": "event",
      "onEvents": [
        {
          "eventRefs": ["NewApplicationEvent"],
          "actionMode": "parallel",
          "actions": [
            {
              "name": "Invoke Check Customer Info Function",
              "functionRef": "CheckCustomerInfo"
            },
            {
              "name": "Invoke Update Application Info Function",
              "functionRef": "UpdateApplicationInfo"
            }
          ]
        }
      ],
      "transition": "MakeApplicationDecision"
    },
    {
      "name": "MakeApplicationDecision",
      "type": "switch",
      "dataConditions": [
        {
          "condition": "${ .customer.age >= 20 }",
          "transition": "ApproveApplication"
        },
        {
          "condition": "${ .customer.age < 20 }",
          "transition": "RejectApplication"
        }
      ],
      "defaultCondition": {
        "transition": "RejectApplication"
      }
    },
    {
      "name": "ApproveApplication",
      "type": "operation",
      "actions": [
        {
          "name": "Invoke Approve Application Function",
          "functionRef": "ApproveApplication",
          "sleep": {
            "before": "PT1S"
          }
        }
      ],
      "end": true
    },
    {
      "name": "RejectApplication",
      "type": "operation",
      "actions": [
        {
          "name": "Invoke Reject Application Function",
          "functionRef": "RejectApplication",
          "sleep": {
            "before": "PT1S"
          }
        }
      ],
      "end": true
    }
  ],
  "functions": [
    {
      "name": "CheckCustomerInfo",
      "type": "rest"
    },
    {
      "name": "UpdateApplicationInfo",
      "type": "rest"
    },
    {
      "name": "ApproveApplication",
      "type": "rest"
    },
    {
      "name": "RejectApplication",
      "type": "rest"
    },
    {
      "name": "QueryCustomerName",
      "type": "expression",
      "operation": "${ .customer.name }"
    },
    {
      "name": "QueryCustomerAge",
      "type": "expression",
      "operation": "${ .customer.age }"
    }
  ],
  "events": [
    {
      "name": "NewApplicationEvent",
      "type": "com.fasterxml.jackson.databind.JsonNode",
      "source": "applicationsSource"
    }
  ]
}

```

Applicant Processing

{
  "id": "applicantworkflow",
  "name": "Applicant Processing Workflow",
  "version": "1.0",
  "specVersion": "0.8",
  "timeouts": {
    "workflowExecTimeout": {
      "duration": "PT2M"
    },
    "actionExecTimeout": "PT10S"
  },
  "autoRetries": true,
  "states": [
    {
      "name": "ApproveApplicant",
      "type": "operation",
      "actions": [
        {
          "name": "approvalAction",
          "functionRef": {
            "refName": "approvalFunction",
            "arguments": {
              "customer": "${ .customer }"
            }
          }
        }
      ],
      "transition": "WaitForDecision"
    },
    {
      "name": "WaitForDecision",
      "type": "event",
      "onEvents": [
        {
          "eventRefs": ["CustomerDecision"]
        }
      ],
      "end": true
    }
  ],
  "functions": [
    {
      "name": "approvalFunction",
      "type": "custom",
      "operation": "approvalworkflow#ToApproveCustomer"
    }
  ],
  "events": [
    {
      "name": "CustomerDecision",
      "type": "com.fasterxml.jackson.databind.JsonNode",
      "source": "applicationsSource"
    }
  ]
}

```
PreviousExamplesNextAdvanced Examples

Last updated 1 year ago