Skip to main content

Dispatch Route

Dispatch routes are daily operational routes assigned to drivers. A route has a date, route type, status, optional driver/equipment/division assignment, and an ordered list of stops. Routes can be created manually or generated from dispatch route templates.

DispatchRoute

PropertyTypeRequiredDescription
DispatchRouteIdintYesPrimary key
OrganizationIdintYesTenant scope
NamestringYesRoute name
RouteTypeDispatchRouteTypeYesDelivery, Pickup, or PickupDelivery
RouteDateDateYesOperational route date (yyyy-MM-dd)
DispatchRouteStatusIdintYesCurrent route status
DispatchRouteTemplateIdint?NoSource template when generated
DivisionIdint?NoOptional division assignment
DriverContactIdint?NoAssigned driver contact; must be a driver contact
EquipmentIdint?NoAssigned equipment
IsDraftboolYesNew/generated routes start as drafts
IsInactiveboolYesSoft-delete flag
CollapsedIntoDispatchRouteIdint?NoRoute this route was merged into
StopsDispatchRouteStop[]NoOrdered route stops
TrackingEventsTrackingEvent[]NoTracking events linked directly to the route
CustomValuesDictionaryNoExtensible custom properties

DispatchRouteStop

PropertyTypeRequiredDescription
DispatchRouteStopIdintYesPrimary key
DispatchRouteIdintYesParent route
StopContactIdint?NoStore/location contact (nullable; use with or without contactAddressId)
ContactAddressIdint?NoSpecific stop address
StopTypeDispatchRouteTypeYesDefaults to the parent route type when omitted
PlannedSequenceintYes1-based planned stop order
ActualSequenceint?NoFinal execution order
EstimatedServiceMinutesint?NoPlanned dwell/service time
DispatchRouteStopStatusIdint?NoCurrent stop-level status
DispatchRouteStopStatusDispatchRouteStopStatus?NoOptional expanded stop status
ActualArrivalTimeDateTime?NoActual arrival timestamp
ActualCompletionTimeDateTime?NoActual completion timestamp
OrderIdsint[]NoAttached order IDs for this stop
OrdersDispatchRouteStopOrder[]NoAttached order links; expand order when full order data is needed
TrackingEventsTrackingEvent[]NoTracking events linked directly to this stop
CustomValuesDictionaryNoExtensible custom properties (use for ad-hoc stop address when not using a contact)

DispatchRouteStopOrder

PropertyTypeRequiredDescription
DispatchRouteStopOrderIdintYesPrimary key
DispatchRouteStopIdintYesParent stop
OrderIdintYesAttached order
OrderOrder?NoOptional expanded order
DispatchRouteStopDispatchRouteStop?NoOptional expanded stop when reached from an order
CustomValuesDictionaryNoExtensible custom properties for the stop/order link

Behavior

  • Create accepts nested stops; planned sequences are assigned contiguously in input order. Stops may attach orders through orderIds.
  • Route updates can replace the nested stops array. Existing stops with dispatchRouteStopId are sparse-updated and resequenced by array order; new stops are added; omitted existing stops are soft-deleted. Stop orderIds reconcile the attached orders to exactly the provided IDs when present. Stop dispatchRouteStopStatusId values are validated against the organization and stop type.
  • updateDispatchRouteStop is a sparse dynamic update: only keys present in values are changed, an explicit null clears a nullable field, and omitted fields remain unchanged. This supports stamping or clearing actualArrivalTime and actualCompletionTime without resending the rest of the stop.
  • Draft routes become operational through activateDispatchRoute.
  • Stops cannot be removed, and routes cannot be deleted, when stops have attached orders.
  • Removing or reordering a stop resequences remaining active stops.
  • Generated routes copy template name, route type, division, and stops; driver/equipment assignment happens later.
  • Stop location/order anchor: A stop's location is either a contact address (contactAddressId, optionally with stopContactId) or an ad-hoc address placed in customValues; alternatively, an order-attached stop can be created with orderIds. A stop must have at least one of stopContactId / contactAddressId / non-empty customValues / non-empty orderIds.
  • Tracking events can be linked to a route or a specific stop. Use route-level events for whole-route milestones and stop-level events for arrival, completion, exception, or proof-of-service milestones tied to one stop.
  • TrackingEvent/Create@1 can attach an event with dispatchRouteId or dispatchRouteStopId. TrackingEvent/Import@1 accepts exactly one of orderId, dispatchRouteId, or dispatchRouteStopId and performs duplicate matching against that target's existing events.