Skip to main content

completeVisit

Requires permission visits:visit:execute.

Completes a visit with its outcome and, when no order came of it, the reason. A visit that is already completed, cancelled or skipped is refused when completed online; an offline replay of an already completed visit returns it unchanged and does not overwrite its outcome. Requires permission to run visits.

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 CompleteVisit($outcome: VisitOutcome!, $visitId: ID!) {
completeVisit(outcome: $outcome, visitId: $visitId) {
id
partnerName
status
createdAt
completedAt
hasUnreadMessage
checkIns {
id
createdAt
checkInAt
checkOutAt
checkOutLatitude
checkOutLongitude
}
}
}

Variables:

{
"outcome": "NO_ORDER",
"visitId": "id"
}

Response:

{
"data": {
"completeVisit": {
"id": "id",
"partnerName": "string",
"status": "CANCELLED",
"createdAt": "2025-01-15T00:00:00Z",
"completedAt": "2025-01-15T00:00:00Z",
"hasUnreadMessage": true,
"checkIns": [
{
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"checkInAt": "2025-01-15T00:00:00Z",
"checkOutAt": "2025-01-15T00:00:00Z",
"checkOutLatitude": 0,
"checkOutLongitude": 0
}
]
}
}
}
completeVisit(
clientCompletedAt: DateTime
noOrderReason: String
outcome: VisitOutcome!
visitId: ID!
): Visit!

Arguments​

completeVisit.clientCompletedAt ● DateTime scalar​

When the rep completed the visit, for an offline replay.

completeVisit.noOrderReason ● String scalar​

Why no order was taken. Optional.

completeVisit.outcome ● VisitOutcome! non-null enum​

The result of the visit.

completeVisit.visitId ● ID! non-null scalar​

The ID of the visit.

Type​

Visit object​

A planned or unplanned visit to a customer.