Skip to main content

applyRoutePlanningRun

Requires at least one of the permissions visits:journey-plan:generate-own or visits:journey-plan:manage.

Runs route planning: adds the stops each rep is due, and when rebuilding removes planner stops after today that have not started. Each rep is planned on its own, so one failing does not stop the others. Only one run per organization at a time; another is refused while one is in progress. A rep who may only refresh their own route can plan only that, keeping existing stops. Requires permission to manage journey plans or to generate your own route.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation ApplyRoutePlanningRun {
applyRoutePlanningRun {
id
actorName
actorUserId
endDate
finishedAt
isPreview
reps {
repName
status
added
addedMissed
addedNewCustomers
addedVisitIds
}
}
}

Response:

{
"data": {
"applyRoutePlanningRun": {
"id": "id",
"actorName": "string",
"actorUserId": "id",
"endDate": "2025-01-15T00:00:00Z",
"finishedAt": "2025-01-15T00:00:00Z",
"isPreview": true,
"reps": [
{
"repName": "string",
"status": "FAILED",
"added": 0,
"addedMissed": 0,
"addedNewCustomers": 0,
"addedVisitIds": [
"id"
]
}
]
}
}
}
applyRoutePlanningRun(
input: RoutePlanningRunInput
): RoutePlanningRun!

Arguments​

applyRoutePlanningRun.input ● RoutePlanningRunInput input​

The reps, days and re-planning mode. Omit fields to use the rules.

Type​

RoutePlanningRun object​

A planning run, or a preview of one.