On this page
postCount
mutation · in the family Inventory adjustments
What it does
Post a completed stock count — the counted truth replaces the book figures.
POST a fully-captured Count: posts every NON-ZERO variance as a count_correct DELTA through ONE transaction — gain to / shrink from on_hand; record lines stamp their StockRecord in the SAME transaction (the SECOND record-touching movement); pool lines post bin-blind (the pool re-derives); costImpact = variance x the II's CURRENT WMA (shrink −/gain +; the WMA itself never re-weights on a count) + unitCost = that WMA + refs [IC-sysId] on EVERY entry (never-silent). Uncaptured lines refuse event-less naming the first-8 lineNos; every varianced line's II must be ACTIVE (CONFLICT/REF_STATE — reactivation free); a ZERO-variance posting is LEG-LESS (pure FSM — posted with no movements). Requires the doc CURRENT revision (OCC) + the unrestricted capability.
What happens
Differences post as signed stock movements, all auditable.
Careful
This IS the moment your books change to match the shelves. Wrong counts post wrong stock — review the variances before posting.
Who may call it
Capability area: Inventory adjustments — Correcting stock with a reason and posting counts.
- Owner
- Manager
- Associate Manager
- An API key whose scope allows
api:postCount
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
id | ID ID! | yes | The id of the record. |
revision | ID ID! | yes | The revision id you read on the record; the change is refused if an edit landed in the meantime. |
reason | String | no | No further notes. |
Returns
Count Count! — A stock count: RECORDED stock vs PHYSICALLY-PRESENT stock at ONE LF, posting count_correct variance DELTAS (never absolute sets). Counts count ON_HAND presence only (condition rides reclass). posted is IMMUTABLE non-doomed history (recount = a NEW linked count); cancelled is the ONE doomed terminal (lists filter it). BLIND-BY-SHAPE while counting: line reads omit snapshot/expected/variance.
Example request
mutation ExamplePostCount($id: ID!, $revision: ID!, $reason: String) {
postCount(id: $id, revision: $revision, reason: $reason) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
organizationId
countType
recountOfCountId
}
}
Variables:
{
"id": "01900000-0000-7000-8000-37386ae00000",
"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
{
"data": {
"postCount": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "IC-EXMP-0000-000F",
"type": "Count",
"caption": "Blue jeans",
"status": "draft",
"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",
"countType": "physical",
"recountOfCountId": "01900000-0000-7000-8000-200395ec0000"
}
},
"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)