Skip to main content

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_created
  • leg_assigned
  • leg_status (optional status matching)

Status matching behavior:

  • status is normalized (lowercased, _/spaces/hyphens removed)
  • triggerRules.status may be blank to match any status

Mode Resolution​

When auto-applying a group:

  1. Use the group’s autoApplyMode if set (dedupe | override)
  2. 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.