Flow Name: Generate Program Number for Accreditation Application¶
Last Updated: 2025-10-22 Source Code: Generate_Program_Number_for_Accreditation_Application.flow-meta.xml
API Name: Generate_Program_Number_for_Accreditation_Application Status: Active Type: Custom Trigger: Before Accreditation_Application__c record create
Business Purpose¶
Automatically generates sequential program numbers for accreditation applications using YYMM prefix format. Ensures each application receives a unique identifier for tracking and reference purposes throughout the accreditation lifecycle.
Process Flow¶
- Queries for last created Accreditation Application with highest program number
- Extracts last 5 digits from existing program number
- Increments sequence by 1
- Generates YYMM date prefix (e.g., "2510" for October 2025)
- Pads sequence to 5 digits with leading zeros
- Concatenates YYMM prefix with padded sequence
- Assigns to Name field of triggering record
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: Before Create]) --> Query[Query Last Program Number]
Query --> Extract[Extract Last 5 Digits]
Extract --> Increment[Increment Sequence]
Increment --> Format[Generate YYMM Prefix]
Format --> Pad[Pad Sequence to 5 Digits]
Pad --> Concat[Concatenate YYMM + Sequence]
Concat --> Assign[Assign to Name Field]
Assign --> End([End])
style Start fill:#e1f5ff
style Query fill:#e1ffe1
style Extract fill:#fff4e1
style Increment fill:#ffe1e1
style Format fill:#e1ffe1
style Pad fill:#fff4e1
style Concat fill:#ffe1e1
style Assign fill:#e1ffe1
style End fill:#e1f5ff
Key Business Rules¶
- Program number format: YYMMXXXXX (YY=year, MM=month, XXXXX=5-digit sequence)
- Sequential numbering increments by 1 for each new application
- Sequence resets with each new month (YYMM prefix changes)
- Supports up to 99,999 applications per month
- First program number defaults to "3000000" if no existing numbers found
Dependencies¶
- Accreditation_Application__c custom object
- Name field on Accreditation_Application__c
- System date functions (TODAY, YEAR, MONTH)
- String manipulation functions (LPAD, TEXT, RIGHT, VALUE)
Changes¶
No Pull Request references found in metadata.
Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- Concurrency risk: Multiple simultaneous creates could assign duplicate numbers without proper locking
- Consider implementing external sequence management or platform event-based numbering
HIGH - Address Soon After Go-Live¶
- Monitor for duplicate program numbers in high-volume creation scenarios
- Add error handling for sequence extraction failures
MEDIUM - Future Enhancement¶
- Consider using Custom Metadata or Platform Cache for sequence management
- Implement retry logic for concurrent creation conflicts
- Add validation to prevent manual program number modification
LOW - Monitor¶
- Track monthly application volumes to ensure 5-digit sequence is sufficient
- Monitor query performance as application volume grows
Maintenance Notes¶
Complexity: Medium - Sequential numbering with date formatting and string manipulation Review Schedule: Semi-annual review recommended Concurrency Warning: Before-save flows with sequential numbering can create race conditions Performance Impact: Queries all records ordered by Name DESC - may slow with large data volumes Testing: Requires concurrent create testing to validate uniqueness