Approval Process: Getting Started
Process Definition
Process definition refers to the systematic planning and description of the entire approval process. It includes all the stages, steps, and the sequence and relationships between each stage. In programming, process definitions usually exist in the form of flowcharts or data structures, graphically or through code, describing the logic of each step.
Common frameworks for implementing approval processes include:
- Activiti: A lightweight workflow and business process management (BPM) platform.
- Camunda: A process engine supporting BPMN 2.0 standards, with strong scalability and flexibility.
- Flowable: An open-source BPM engine that supports rich features and complex process definitions.
Process Instance
A process instance is a specific approval process created based on the process definition. Each specific approval request generates a process instance. Process instances reflect the progress of a specific transaction within the approval process. Through process instances, we can track the status and history of each approval request.
Approval Nodes
Approval nodes are specific stages within the approval process. Each approval node has specific approval conditions and operations. Approval nodes can be single-step approvals or complex nodes requiring multiple approvals. In programming, the implementation of approval nodes usually involves conditional judgments and process control.
Approval Tasks
Approval tasks refer to the specific work that needs to be completed at the approval nodes. Approval tasks can be simple operations such as agreeing or rejecting, or more complex operations such as filling out forms or uploading attachments. In programming, the management and allocation of approval tasks are usually implemented through task queues or task management systems.
Approvers
Approvers are the people responsible for executing approval tasks within the approval process. Approvers can be specific employees, team leaders, or dynamically designated based on specific rules. In programming, the management of approvers typically includes permission control and task allocation.
Implementing an Approval Workflow Database Table
1. Process Definitions Table (Process_Definitions)
Stores basic information about process definitions.
CREATE TABLE Process_Definitions (
Process_Definition_ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Description TEXT,
Created_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
2. Process Instances Table (Process_Instances)
Stores information about each process instance.
CREATE TABLE Process_Instances (
Process_Instance_ID INT PRIMARY KEY AUTO_INCREMENT,
Process_Definition_ID INT,
Status VARCHAR(50),
Created_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
Updated_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (Process_Definition_ID) REFERENCES Process_Definitions(Process_Definition_ID)
);
3. Approval Nodes Table (Approval_Nodes)
Stores information about each approval node.
CREATE TABLE Approval_Nodes (
Node_ID INT PRIMARY KEY AUTO_INCREMENT,
Process_Definition_ID INT,
Name VARCHAR(255),
Description TEXT,
FOREIGN KEY (Process_Definition_ID) REFERENCES Process_Definitions(Process_Definition_ID)
);
4. Approval Tasks Table (Approval_Tasks)
Stores information about each approval task.
CREATE TABLE Approval_Tasks (
Task_ID INT PRIMARY KEY AUTO_INCREMENT,
Process_Instance_ID INT,
Node_ID INT,
Assignee VARCHAR(255),
Status VARCHAR(50),
Created_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
Completed_At TIMESTAMP NULL,
FOREIGN KEY (Process_Instance_ID) REFERENCES Process_Instances(Process_Instance_ID),
FOREIGN KEY (Node_ID) REFERENCES Approval_Nodes(Node_ID)
);
5. Approvers Table (Approvers)
Stores information about all approvers.
CREATE TABLE Approvers (
Approver_ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Email VARCHAR(255) NOT NULL UNIQUE,
Role VARCHAR(255),
Created_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
6. Approval Logs Table (Approval_Logs)
Stores operation records of each approval task.
CREATE TABLE Approval_Logs (
Log_ID INT PRIMARY KEY AUTO_INCREMENT,
Task_ID INT,
Approver_ID INT,
Action VARCHAR(50),
Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
Comments TEXT,
FOREIGN KEY (Task_ID) REFERENCES Approval_Tasks(Task_ID),
FOREIGN KEY (Approver_ID) REFERENCES Approvers(Approver_ID)
);