Skip to main content

generateRoutePlan

Requires permission visits:journey-plan:manage.

Generates a route plan for one sales rep over a cycle of days from a start date, grouping their customers by location and visit cadence. The caller needs authority over that rep. Requires permission to manage journey plans.

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 GenerateRoutePlan($input: GenerateRoutePlanInput!) {
generateRoutePlan(input: $input) {
deferred {
id
name
customerTierName
customerTier
lastVisitedAt
}
}
}

Variables:

{
"input": {
"cycleLengthDays": 0,
"cycleStartDate": "2025-01-15T00:00:00Z",
"salesRepId": "string"
}
}

Response:

{
"data": {
"generateRoutePlan": {
"deferred": [
{
"id": "id",
"name": "string",
"customerTierName": "string",
"customerTier": "string",
"lastVisitedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
generateRoutePlan(
input: GenerateRoutePlanInput!
): GenerateRoutePlanResult!

Arguments​

generateRoutePlan.input ● GenerateRoutePlanInput! non-null input​

The rep, the cycle length in days, the cycle start date and whether to include Sundays.

Type​

GenerateRoutePlanResult object​

The route plans created or updated, and the customers who did not fit.