Rule-based automatic ticket assignment mixin for ObjTicket.
Provides configurable rules that automatically assign newly
created tickets to a specific person based on matching
criteria. Rules are stored in def_ticket_assign_rules and
evaluated using a specificity-based fallback hierarchy.
When a ticket is created without an explicit assignee, the
mixin searches for a matching rule in this order:
The first match wins. If no rule matches, the ticket remains
unassigned.
CREATE TABLE def_ticket_assign_rules (
Id INT AUTO_INCREMENT PRIMARY KEY,
Package CHAR(255) NOT NULL DEFAULT '',
Project VARCHAR(255) NOT NULL DEFAULT '',
Priority VARCHAR(20) NOT NULL DEFAULT '',
TicketType VARCHAR(50) NOT NULL DEFAULT '',
AssignTo VARCHAR(255) NOT NULL,
Active CHAR(2) DEFAULT 'Y',
CreatedDate DATETIME DEFAULT CURRENT_TIMESTAMP
);
Finds the best-matching assignment rule. Returns the
AssignTo value or empty string if no rule matched.
Returns all assignment rules for a package as a list of
dictionaries.
Inserts a new assignment rule.
Deletes an assignment rule by ID (scoped to package).
The mixin is wired into the ObjTicket class MRO. After
create() inserts the ticket and completes the initial
notifications, it calls auto_assign() if no explicit
assignee was set. A successful match triggers assign()
with action_by="AUTO_ASSIGN".
Available via python ObjTicket.py:
| Command | Description |
|---|---|
list-rules |
List all rules for a package |
add-rule |
Add a new auto-assign rule |
remove-rule |
Remove a rule by ID |
# List rules for current package
python ObjTicket.py list-rules
# Add a rule: all CRITICAL tickets in INFRA project
python ObjTicket.py add-rule ops@example.com \
--project INFRA --priority CRITICAL
# Add a package-wide default
python ObjTicket.py add-rule support@example.com
# Remove rule ID 3
python ObjTicket.py remove-rule 3
Queries and schema are defined in the companion
ObjTicketAutoAssign.yaml file, resolved via the
MRO-based YAML loader in ObjData.