reportExternalIssue mutation
reportExternalIssue is a GraphQL mutation of the Chameleoon MAX API. Send it as POST https://max-api.chameleoon.sk/api/v1/graphql with your API key, see Chameleoon MAX.
Records that an externally managed warehouse already took goods of the order off its stock
with one of its own documents. Call it when the external system that manages the warehouse
(see syncStockLevels) issues an invoice that takes goods off stock, or a credit
note that returns them, before MAX picked or dispatched the goods.
What the report does:
- The external system's stock snapshots no longer take the same goods off twice.
- The order's reservations stay.
- When MAX issues the goods itself, it offsets them against the report.
- What MAX never issues stays open on the item (
externallyIssuedOpen). When MAX will issue nothing more of the order, it opens the exceptionEXTERNAL_ISSUE_OPENfor a user in MAX. - The report never blocks the order.
Each item's quantity is absolute for the combination of external system,
documentExternalIdand item. Send everything the document issued of the item, not a change.
Permissions
Requires the stock.sync, integration.read, order.write and order.read permissions.
Repeated calls
MAX writes only the difference against what the same document reported before. A repeat
changes nothing. Send a corrected document again with its new quantities. An order created
with externalIssue already holds its document's quantities.
Your contract
MAX cannot check these rules, so your integration must follow them:
effectiveAtis on the same clock asasOfofsyncStockLevels: the external system's own clock. If the system keeps local time without a time zone (Pohoda), convert both values with its time zone. Otherwise MAX cannot tell whether a snapshot contains the issue.- Send a snapshot with
asOfonly after you reported every external issue witheffectiveAtat or beforeasOf. A snapshot sent before the report takes the goods off stock until the report arrives. - When a corrected document no longer has an item, send the item with quantity 0.
- A repeat of
createSalesOrderwhose document changed in the meantime keeps the first quantities (DUPLICATE_WITH_DIFFERENT_CONTENT). Send the corrected quantities here, under the samedocumentExternalId. documentExternalIdis the document's number in the external system (in Pohoda, the invoice number). It must be unique there across accounting years.- When a document's items left several warehouses, report the document once per warehouse, each call with its own items. One document reports an item in one warehouse. To move the item, report 0 in the first warehouse.
- Report a reversal (a credit note or a cancelled invoice) as a separate document, with a negative quantity on the original item.
- Returns are out of scope. A credit note for goods MAX already dispatched is refused
(
EXTERNAL_ISSUE_BELOW_ISSUED). A reversal of an invoice whose goods MAX has not dispatched, or whose consignment MAX cancelled, is reported here and balances the invoice. - MAX offsets the order's own issues against the reports, so they are not confirmed:
confirmStockInExternalSystemrefuses them. Sometimes MAX issues more than the external documents took off, for example when an invoice was cancelled before dispatch or covered only part of an item. Once you write that surplus into the external system with a document of its own, report it here under that document's id.
Errors
One refusal refuses the whole call.
NOT_FOUNDwhen the order or the warehouse does not exist, or your API key cannot see it. MAX checks the order before any item.CONFLICTwithextensions.reasonSTOCK_NOT_MASTERED(fieldwarehouseId) when no external system manages the warehouse.CONFLICTwithextensions.reasonORDER_STATUSandextensions.fieldsalesOrderwhen the order is a draft (confirm it first) or merged into another order (report on that one).VALIDATIONonsalesOrderwhen the reference names the order by neither or both ofidandsourcewithexternalId.- A refusal of the item itself names the input that named the item
(
items[i].salesOrderItemIdoritems[i].itemExternalId).
CONFLICT with extensions.field items[i].quantity and one of these reasons:
| Reason | When |
|---|---|
EXTERNAL_ISSUE_OVER_QUANTITY | An item's reports would add up to more than its quantity. |
EXTERNAL_ISSUE_NEGATIVE | An item's reports would add up to less than zero. |
EXTERNAL_ISSUE_BELOW_ISSUED | A lower quantity would take back goods of the item that MAX already issued and keeps issued. |
EXTERNAL_ISSUE_OTHER_WAREHOUSE | The document already reported the item in another warehouse. |
VALIDATION for any of these:
- A blank
documentExternalId, or one over 128 bytes. - An
effectiveAtmore than 15 minutes ahead of the MAX clock. - No items, or more than 100.
- An item named by neither or both of
salesOrderItemIdanditemExternalId. - An
itemExternalIdthat names no item of the order, or several. - The same item twice.
- A quantity with more than three decimals, or one that does not convert into the item's base units within six decimals.
- An item of another order.
- A set's own item. Report its components instead.
- An item not linked to a product.
- A warehouse of another company than the order's.
An error whose path runs below this field does not mean the call failed: the issue was recorded, so do not retry. See
Mutation.
Costs 1 point plus 1 per item, plus its selection.
Arguments
input:ReportExternalIssueInput!· required
Returns
Example
Mutation
Code
Variables
Code
Response
Code
Values are illustrative: replace IDs and codes with your own before you send the call.