Task Template Groups: Auto-Apply (Developer)
Auto-apply allows TaskTemplateGroups to be applied automatically based on trucking lifecycle events.
Feature Flag / Safe Rolloutβ
Auto-apply is gated by customer config:
tasks.autoApplyGroups.enabled(default:false)tasks.autoApplyGroups.defaultMode(default:dedupe)
If disabled, trigger evaluation is a no-op.
Trigger Eventsβ
Supported triggerRules[].event values:
leg_createdleg_assignedleg_status(optional status matching)
Status matching behavior:
- status is normalized (lowercased,
_/spaces/hyphens removed) triggerRules.statusmay be blank to match any status
Mode Resolutionβ
When auto-applying a group:
- Use the groupβs
autoApplyModeif set (dedupe | override) - Otherwise use customer-config
tasks.autoApplyGroups.defaultMode
Scope Resolution (Same groupKey)β
If multiple groups match the same groupKey, the system prefers company scope over system scope.
Where Triggers Fire (API)β
Auto-apply is invoked on key leg events:
- Leg create β event
leg_created - Driver assignment (job assignment, scheduler updates, leg update driver) β event
leg_assigned - Leg status update / completion β event
leg_status
Operational Notesβ
- Auto-apply uses the same apply logic as manual apply-group endpoints, so dedupe/override behavior is consistent.
- The implementation is intentionally conservative: failures are caught and logged so core workflow operations donβt hard-fail if auto-apply encounters an error.