Task Numbering System
Revision 1.0 (2026-02-23) - Initial documentation
Feature Summary
The Task Numbering System automatically generates a unique, human-readable reference number for every workflow task created in the platform. This number appears across all views — task toolbar, task lists, print previews, and PDF/XLSX exports — providing a consistent identifier for cross-referencing tasks in meetings, reports, and communications.
Key Capabilities:
- Automatic number generation at task creation (no manual input)
- Configurable format per employer (6 built-in options)
- Customizable type prefixes per workflow type
- Atomic sequence generation (no duplicates, even under concurrent load)
- Visible in all task views: toolbar, My Tasks, All Tasks, print preview, PDF/XLSX export
Design Decision: "Task No." vs "Document No."
We chose Task No. (เลขที่งาน) instead of Document No. (เลขที่เอกสาร).
Why? Each workflow task may contain multiple documents (e.g., a Project Registration task contains both the Registration Form and the Pre-Work Procedures Form). A single task number covers all documents within that task.
If we used "Document No." instead, it would imply each document has its own unique number — which would require a more complex per-document numbering system that adds overhead without clear benefit at this stage.
Please confirm: Is "Task No." the right label? Or should each document have its own number?
Visual Comparison
┌─────────────────────────────────────────────────────┐
│ Option A: Task No. (Current — Recommended) │
│ │
│ Task: REG-202602-000001 │
│ ├── Project Registration Form (same number) │
│ └── Pre-Work Procedures Form (same number) │
│ │
│ + Simple: one number per task │
│ + Easy to reference in meetings │
│ + "Check task REG-202602-000001" — clear & short │
├─────────────────────────────────────────────────────┤
│ Option B: Document No. (Over-engineered) │
│ │
│ Task: REG-202602-000001 │
│ ├── Project Registration Form REG-202602-000001/1│
│ └── Pre-Work Procedures Form REG-202602-000001/2│
│ │
│ - More complexity with little benefit │
│ - Users rarely reference individual documents │
│ - Longer number, harder to communicate verbally │
└─────────────────────────────────────────────────────┘
Number Format
The task number follows this pattern:
{TypePrefix}-{DatePart}-{PaddedRunningNumber}
Format Options (6 choices)
Employers can choose from 6 built-in formats in Settings > Employer > Document Numbering:
| # | Calendar | Format | Example |
|---|---|---|---|
| 1 | CE (ค.ศ.) | Year/Month/Day/Run | REG-20260223-0001 |
| 2 | CE (ค.ศ.) | Year/Month/Run | REG-202602-000001 |
| 3 | CE (ค.ศ.) | Year/Run | REG-2026-00000001 |
| 4 | BE (พ.ศ.) | Year/Month/Day/Run | REG-25690223-0001 |
| 5 | BE (พ.ศ.) | Year/Month/Run | REG-256902-000001 |
| 6 | BE (พ.ศ.) | Year/Run | REG-2569-00000001 |
Trade-offs by format:
Granularity: Daily ◄──────────────────► Yearly
Format 1,4 Format 2,5 Format 3,6
Counter size: 4 digits 6 digits 8 digits
Reset cycle: Every day Every month Every year
Best for: High volume Medium volume Low volume
(many tasks (standard (small
per day) operations) teams)
Type Prefixes (Customizable)
Each workflow type has a default prefix that can be changed per employer:
| Workflow Type | Default Prefix | Example Number |
|---|---|---|
| Project Registration (ขึ้นทะเบียนโครงการ) | REG | REG-202602-000001 |
| Contractor Registration (ลงทะเบียนผู้รับเหมา) | CR | CR-202602-000001 |
| Work Permit Request (ขอใบอนุญาตทำงาน) | WP | WP-202602-000001 |
| Training Enrollment (ส่งรายชื่อผู้อบรม) | TE | TE-202602-000001 |
| JSA Preparation (จัดเตรียม JSA) | JSA | JSA-202602-000001 |
| Tool List Preparation (รายการเครื่องมือ) | TL | TL-202602-000001 |
| Contractor Evaluation (ประเมินผู้รับเหมา) | CE | CE-202602-000001 |
Where Task Numbers Appear
┌──────────────────────────────────────────────┐
│ 1. Task Toolbar (Review Task) │
│ ┌────────────────────────────────────────┐ │
│ │ [Status: ...] [REG-202602-000001] │ │
│ └────────────────────────────────────────┘ │
│ │
│ 2. My Tasks (Task Cards) │
│ ┌────────────────────────────────────────┐ │
│ │ Project Registration │ │
│ │ REG-202602-000001 (monospace, gray) │ │
│ │ Project ABC │ │
│ └────────────────────────────────────────┘ │
│ │
│ 3. All Tasks (Table Column) │
│ ┌──────────┬──────────────────┬──────────┐ │
│ │ Type │ Task No. │ Project │ │
│ ├──────────┼──────────────────┼──────────┤ │
│ │ PR │ REG-202602-0001 │ ABC │ │
│ │ JSA │ JSA-202602-0002 │ ABC │ │
│ └──────────┴──────────────────┴──────────┘ │
│ │
│ 4. Print Preview (Header) │
│ ┌────────────────────────────────────────┐ │
│ │ Task No.: REG-... │ │
│ │ [Form Title] │ │
│ └────────────────────────────────────────┘ │
│ │
│ 5. PDF/XLSX Export (Header) │
│ ┌────────────────────────────────────────┐ │
│ │ Task No.: REG-202602-000001 │ │
│ │ [Document content below] │ │
│ └────────────────────────────────────────┘ │
└──────────────────────────────────────────────┘
Searchable in All Tasks
The task number is included in the keyword search in the All Tasks view. Users can type part of a task number (e.g., REG-2026 or 000001) to quickly find tasks.
Settings Configuration
Location: Settings (เครื่องมือ) > Employer Setting (ตั้งค่าบริษัท) > Document Numbering tab (เลขรันงาน)
The settings page has two sections:
Section 1: Format Selection
Radio buttons to choose one of the 6 formats. Each option shows a live preview of what the number will look like.
┌───────────────────────────────────────────────────┐
│ Task Number Format │
│ │
│ o CE Year/Month/Day/Run REG-20260223-0001 │
│ * CE Year/Month/Run REG-202602-000001 │
│ o CE Year/Run REG-2026-00000001 │
│ o BE Year/Month/Day/Run REG-25690223-0001 │
│ o BE Year/Month/Run REG-256902-000001 │
│ o BE Year/Run REG-2569-00000001 │
└───────────────────────────────────────────────────┘
Section 2: Type Prefix Configuration
Editable table where each workflow type's prefix can be customized. The preview column updates in real-time.
┌──────────────────────────────────────────────────┐
│ Type Prefixes │
│ │
│ Workflow Type │ Prefix │ Preview │
│ Project Registration │ [REG ] │ REG-... │
│ Contractor Registration │ [CR ] │ CR-... │
│ Work Permit Request │ [WP ] │ WP-... │
│ Training Enrollment │ [TE ] │ TE-... │
│ JSA Preparation │ [JSA ] │ JSA-... │
│ Tool List Preparation │ [TL ] │ TL-... │
│ Contractor Evaluation │ [CE ] │ CE-... │
└──────────────────────────────────────────────────┘
Behavior Rules
| Scenario | Behavior |
|---|---|
| New task created | Number auto-generated based on current format + prefix |
| Format changed in settings | Only affects new tasks; existing numbers are permanent |
| Prefix changed in settings | Only affects new tasks; existing numbers unchanged |
| Task cancelled/closed | Number remains assigned (never recycled) |
| Existing tasks (before feature) | Show dash - or empty (no retroactive numbering) |
| Concurrent task creation | Atomic PostgreSQL UPSERT prevents duplicate numbers |
What to Test
| # | Test Case | Expected Result |
|---|---|---|
| 1 | Create a new workflow task | Task number generated and shown in toolbar |
| 2 | View task in My Tasks list | Task number visible on task card |
| 3 | Search by task number in All Tasks | Task found by partial number match |
| 4 | Open print preview | Task number shown in header |
| 5 | Export PDF | Task number in document header |
| 6 | Change numbering format in settings | New tasks use new format; old tasks unchanged |
| 7 | Change type prefix in settings | New tasks use new prefix; old tasks unchanged |
| 8 | Create 2 tasks of same type quickly | Sequential numbers (no gaps, no duplicates) |
| 9 | Verify Buddhist Era formats (4-6) | Year shows +543 (e.g., 2569 instead of 2026) |
| 10 | Existing tasks without number | Shows dash or empty gracefully |
Related Features
- Employer Setting - Contains the numbering configuration
- Print & Export - Task number appears in PDF/XLSX headers
- My Tasks - Task number on cards
- Auto Save - Settings saved through employer save flow