AlmondTill/G3N API

On this page

updateWarranty

mutation · in the family Warranty

What it does

Edit warranty terms on what you sell — change its details.

Edit a Warranty's mutable attributes. Requires the unrestricted capability + the record's CURRENT revision.

Careful

Edits take effect immediately and write a new revision; the old revision stays in history.

Who may call it

Capability area: Selling — Ringing sales, serving customers and issuing invoices.

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.
inputEditWarrantyInput EditWarrantyInput!yesNo further notes.

Returns

Warranty Warranty! — A Warranty — THE WARRANTY INSTANCE: one sold order line under one WarrantyTerms template. Born by the ENGINE when the sale completes (paid AND delivered) for every variant line whose product carries an active product-attached template or whose variant names a manufacturer carrying an active manufacturer-attached template (one warranty per matching template); never created on the wire. The policy is SNAPSHOTTED at birth (provider · durationDays → expiresAt = startsAt + durationDays), so later template edits never rewrite an issued warranty. active → expired is the scheduler’s over expiresAt; active → claimed is fileClaimWarranty (a warranty_claim CsCase linked both ways). The serial number is optional and stamped through updateWarranty. Listings keep expired warranties as coverage history (the settled-payment class — a status filter narrows to active); every warranty stays reachable by id from the order line’s warrantyIds.

Example request

mutation ExampleUpdateWarranty($id: ID!, $revision: ID!, $input: EditWarrantyInput!) {
  updateWarranty(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    orderLineNo
    variantId
    productId
    warrantyTermsId
    provider
    durationDays
    quantity
    startsAt
    expiresAt
    consumerId
    serialNumber
    caseId
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "serialNumber": "<serial number>"
  }
}

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

Example response

{
  "data": {
    "updateWarranty": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "WR-EXMP-0000-000F",
      "type": "Warranty",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "orderLineNo": 1,
      "variantId": "01900000-0000-7000-8000-8415e73b0000",
      "productId": "01900000-0000-7000-8000-969657010000",
      "warrantyTermsId": "01900000-0000-7000-8000-d9cacfd90000",
      "provider": "manufacturer",
      "durationDays": 1,
      "quantity": "2",
      "startsAt": "2027-01-31T00:00:00.000Z",
      "expiresAt": "2027-01-31T00:00:00.000Z",
      "consumerId": "01900000-0000-7000-8000-6e8c92ec0000",
      "serialNumber": "<serial number>",
      "caseId": "01900000-0000-7000-8000-4559fce40000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.

Used in