# Issue type


An issue: goods that left one warehouse.

## Fields

### stockVersion

`String`

The document's version for [`confirmStockInExternalSystem`](/chameleoon-max/mutation/confirm-stock-in-external-system). Read it, write the
document to the external system, then confirm that version. Null before the issue has moved
any stock.

### id

[`UUID!`](/chameleoon-max/type/uuid)

The issue's MAX id.

### number

`String!`

The issue's number. Every returned issue has one.

### status

[`IssueStatus!`](/chameleoon-max/type/issue-status)

The issue's status.

### version

`Int`

The issue's last event version, as in the events feed. Null before its first event. Also null
when an event newer than this read was committed while the issue was being read; read it
again.

### effectiveAt

[`Time!`](/chameleoon-max/type/time)

When the goods count as issued.

### completedAt

[`Time`](/chameleoon-max/type/time)

When the issue was completed. Null until it is completed.

### cancelledAt

[`Time`](/chameleoon-max/type/time)

When the issue was cancelled. Null unless it is cancelled.

### revision

`Int!`

How many times the completed issue has been revised. `0` when it was completed and never
revised.

### warehouseId

[`UUID!`](/chameleoon-max/type/uuid)

The MAX id of the warehouse the goods left.

### warehouse

[`Warehouse`](/chameleoon-max/type/warehouse)

The warehouse the goods left.

- Requires the `warehouse.read` permission. Without it, the field is null with a
  `FORBIDDEN_ROLE` error at its path (`extensions.permission`).
- Outside your API key's warehouse scope, the field is null with a `FORBIDDEN_SCOPE` error at
  its path (`extensions.scope` `WAREHOUSE`).
- In both cases the rest of the response is returned.

### legalEntityId

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of the legal entity (the company) the issue belongs to. Null when it belongs to
none.

### partnerId

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of the partner the goods went to. Null when the issue names no partner.

### partner

[`Partner`](/chameleoon-max/type/partner)

The partner the goods went to.

- Requires the `partner.read` permission. Without it, the field is null with a
  `FORBIDDEN_ROLE` error at its path (`extensions.permission`).
- A partner outside your API key's partner scope is null with a `FORBIDDEN_SCOPE` error at
  its path (`extensions.scope` `PARTNER`).
- In both cases the rest of the response is returned.
- An erased partner keeps its id and code, with `name` null.

### origin

[`IssueOrigin!`](/chameleoon-max/type/issue-origin)

What the issue was created from.

### externalReference

`String`

The external reference the issue was filed with. Null, without an error, when the issue's
partner is outside your API key's partner scope.

### currencyCode

`String!`

The ISO 4217 code of the issue's currency.

### totalValue

[`Decimal`](/chameleoon-max/type/decimal)

What the goods were worth, without VAT, as a positive amount: the sum of the lines' values.
Null while the costing of any line is pending. A completed issue can still be pending, so read
it again later.

It reads every stock movement of the document.

Costs 10 points.

### costingPending

`Boolean!`

`true` while the costing of any line is pending. A completed issue can still be pending, and
no event is sent when its costing finishes, so read it again later.

It reads every stock movement of the document.

Costs 10 points.

### lines

[`IssueLineConnection`](/chameleoon-max/type/issue-line-connection)

Arguments:

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

The goods lines, by line number, then id.

- A connection, paged with `first`/`after` or `last`/`before`, at most 250 a page. Its
  cursors belong to this issue's lines; any other connection refuses them.
- Null, with an error at its path, when its page cannot be read, for example because of a
  cursor of another parent. The rest of the response is returned.
- A page costs 2 + first (or last) × the cost of one node.

### externalRefs

[`ExternalRefConnection`](/chameleoon-max/type/external-ref-connection)

Arguments:

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

The records that external systems made of this issue ([`setIssueExternalRef`](/chameleoon-max/mutation/set-issue-external-ref)), at
most one per external source.

- A connection, paged with `first`/`after` or `last`/`before`, at most 250 a page. Its
  cursors belong to this issue's references; any other connection refuses them.
- Read together with the issue: requires the `issue.read` permission, not
  `integration.read`. Without it, null with `FORBIDDEN_ROLE` at its path.
- Null, with an error at its path, when its page cannot be read, for example because of a
  cursor of another parent. The rest of the response is returned.
- A page costs 2 + first (or last) × the cost of one node.

## Used by

- [`IssueConnection`](/chameleoon-max/type/issue-connection)
- [`IssueEdge`](/chameleoon-max/type/issue-edge)
- [`IssueExternalRefResult`](/chameleoon-max/type/issue-external-ref-result)
