On this page
repairInventoryOnOrder
mutation · in the family Inventory operations
What it does
Correct one stock item’s on-order figure to what your open purchase orders add up to — with a reason.
REPAIR one junction's on-order figure: re-derive the InventoryItem's onOrderQty from the receivable purchase orders' open lines for its variant × logical facility and stamp THAT figure over the stored one — ONE OCC full-item write with the REQUIRED reason on the revision cause (kind edit); a converged cell answers changed false and writes nothing. No stock moves and no Stock-Card entry posts — on order is bookkeeping beside the five buckets, never a bucket. 'reason' is REQUIRED and non-blank (blank/oversize refuse VALIDATION/INVALID naming the cure). Requires the unrestricted capability.
What happens
Rewrites that one figure and records the reason; nothing moves in stock and no ledger entry posts. An item that already agrees is left alone and says so.
Careful
Repairing while an order is still walking writes a figure the walk’s next chunk moves again — let the walk finish first.
Who may call it
Capability area: Inventory operations — Receiving, counting, transferring and moving stock.
- Owner
- Manager
- Associate Manager
- Warehouse Associate
- An API key whose scope allows
api:repairInventoryOnOrder
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
id | ID ID! | yes | The id of the record. |
reason | String String! | yes | No further notes. |
Returns
InventoryOnOrderRepair InventoryOnOrderRepair! — The answer of ONE on-order repair: the junction as it now stands, the figure it held before, the derived figure it was stamped to, and whether anything changed (a converged cell answers false — nothing written).
Example request
mutation ExampleRepairInventoryOnOrder($id: ID!, $reason: String!) {
repairInventoryOnOrder(id: $id, reason: $reason) {
previous
derived
changed
}
}
Variables:
{
"id": "01900000-0000-7000-8000-37386ae00000",
"reason": "Correcting a miscount."
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"repairInventoryOnOrder": {
"previous": "<previous>",
"derived": "<derived>",
"changed": true
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. (NOT_FOUND)CONFLICT/*— The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. (CONFLICT)VALIDATION/VERSION_REQUIRED— The request did not say which app version it came from. (VALIDATION)