AlmondTill/G3N API

cancelReceipt

mutation · in the family Inventory operations

What it does

Cancel a goods receipt — stock arriving from a purchase order.

Cancel a draft Receipt: cancelled is the doomed terminal (lists filter it; a new arrival is a NEW Receipt). Requires the doc current revision + the unrestricted capability.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Inventory operations — Receiving, counting, transferring and moving stock.

Roles that may call it:

Careful

Cancellation is usually permanent — check what the record has already caused (reservations, payments) before cancelling.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
reasonStringno

Concurrency

Send the record’s current revision from your last read as revision. A stale revision is refused as CONFLICT/REVISION_STALE — read the record again and retry with the new value.

Returns

Receipt Receipt! — Over-receipt refuses CONFLICT/THREE_WAY_MATCH; under-receipt is partial, first-class — the next receipt is a NEW doc. posted is the immutable NON-doomed fact (corrections are compensating movements, never edits); cancelled is the doomed terminal (lists filter it). Re-running post resumes a stalled walk; on a healthy in-flight receipt it refuses CONFLICT/IN_PROGRESS naming the progress; one receipt posts against a purchase order at a time (its receivingReceiptId).

Example request

graphql
mutation ExampleCancelReceipt($id: ID!, $revision: ID!, $reason: String) {
  cancelReceipt(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    organizationId
    lineCount
    nextLineNo
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-1b9120e30000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "cancelReceipt": {
      "id": "01900000-0000-7000-8000-1b9120e30000",
      "sysId": "RC-EXMP-0000-000F",
      "type": "Receipt",
      "caption": "Blue jeans",
      "status": "cancelled",
      "parentId": "01900000-0000-7000-8000-da3499da0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "logicalFacilityId": "01900000-0000-7000-8000-10c08c590000",
      "organizationId": "01900000-0000-7000-8000-1971e30a0000",
      "lineCount": 1,
      "nextLineNo": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer