SalesOrder type
A sales order: a customer's order for goods, which MAX reserves stock for, ships and tracks until it is paid and completed.
Fields
id
The order's MAX id.
number
String
The order's number. Null while the order is a draft.
status
The order's status in its life cycle.
legalEntityId
The MAX id of the legal entity (the company) that sells. Null when the order has no legal entity.
source
String
The code of the external source that placed the order. Null for an order created in MAX. Also
null, together with externalId and externalNumber, when your API key is limited to other
partners.
externalId
String
The order's id in the external source.
externalNumber
String
The order number the customer saw in the e-shop.
sourceUrl
String
A link to the order in the e-shop's administration.
orderedAt
When the customer placed the order.
confirmedAt
When the order was confirmed, on the MAX clock.
fulfilmentStatus
How much of the order has left the warehouse.
paymentStatus
Whether the order is paid.
currencyCode
String!
The ISO 4217 code of the order's currency.
pricesIncludeVat
Boolean
Whether the order's prices include VAT, as its priced items say. If no item is priced, as its
charges other than ROUNDING say. Null when neither has a price.
totalNet
The amount owed without VAT, excluding cancelled quantities.
totalVat
The VAT on totalNet.
totalGross
The amount owed including VAT.
paidAmount
The amount the customer has paid, less refunds.
discountPercent
The order-wide discount in percent, taken off every goods line after the line's own discount.
lineTotal and the totals already include it. Charges are not discounted. Null when there is
none.
invoiceNumber
String
The number of the invoice that another system issued for this order
(setSalesOrderInvoice). Null while there is none. A change of it is a transition
in the order's events (see events). invoiceExternalId is not tracked there, so a change of
it alone still publishes sales_order.changed, with no transition.
invoiceExternalId
String
The invoice's id in the system that issued it. Null while there is none.
vatTreatment
The VAT regime. For an order from createSalesOrder, what the external source
stated. For an order entered in MAX, what MAX determined. Null when neither applies.
vatDestinationCountry
String
The state of a DESTINATION_VAT regime, as stated or else as determined.
- Requires the
partner.readpermission (otherwiseFORBIDDEN_ROLE) and the customer in your API key's partner scope (otherwiseFORBIDDEN_SCOPE). - Null once the customer is erased.
customerId
The customer's MAX id. Returned to every API key that can read the order.
customer
The customer who ordered.
- Requires the
partner.readpermission. Without it, null withFORBIDDEN_ROLE. - Outside your API key's partner scope, null with
FORBIDDEN_SCOPE(extensions.scopePARTNER). - An erased customer is returned with
namenull.
billingAddress
The version of the billing address that the order keeps, unchanged since the order took it.
- Requires the
partner.readpermission (otherwiseFORBIDDEN_ROLE) and the customer in your API key's partner scope (otherwiseFORBIDDEN_SCOPE). - Null once the customer is erased.
deliveryAddress
The version of the delivery address that the order keeps, unchanged since the order took it.
- Requires the
partner.readpermission (otherwiseFORBIDDEN_ROLE) and the customer in your API key's partner scope (otherwiseFORBIDDEN_SCOPE). - Null once the customer is erased.
pickupPoint
The carrier's collection point, when the order is delivered to one.
sourceDeliveryMethod
The delivery method in the external source's own words.
carrier
The carrier and profile that ship the order. Null when none was selected, or when the
requested pair was unknown or unverified; those problems are listed in exceptions.
paymentMethod
How the customer intends to pay.
sourcePaymentMethod
The payment method in the external source's own words.
contactEmail
String
The e-mail the customer gave for this order.
- Requires the
partner.readpermission (otherwiseFORBIDDEN_ROLE) and the customer in your API key's partner scope (otherwiseFORBIDDEN_SCOPE). - Null once the customer is erased.
contactPhone
String
The phone the customer gave for this order.
- Requires the
partner.readpermission (otherwiseFORBIDDEN_ROLE) and the customer in your API key's partner scope (otherwiseFORBIDDEN_SCOPE). - Null once the customer is erased.
preferredWarehouseId
The MAX id of the warehouse the order reserves stock from, when it has one.
preferredWarehouse
The warehouse the order reserves stock from.
- Requires the
warehouse.readpermission. Without it, null withFORBIDDEN_ROLE. - Outside your API key's warehouse scope, null with
FORBIDDEN_SCOPE(extensions.scopeWAREHOUSE).
note
String
What the customer wrote with the order. Null once the customer is erased.
internalNote
String
The internal remark on the order (from the external source's internal note), never the customer's. Null once the customer is erased.
billingAddressEditedInErp
Boolean!
Whether a user changed the billing address in MAX since the external source last sent it.
When true, a new billing address from the external source is a conflict that a user in MAX
resolves. An integration that writes the MAX address back to the external source can tell that
it is the MAX user's choice.
deliveryAddressEditedInErp
Boolean!
Whether a user changed the delivery address in MAX since the external source last sent it.
Same meaning as billingAddressEditedInErp, for the delivery address.
itemsEditedInErp
Boolean!
Whether a user changed the order's goods or charges in MAX since the external source last sent them.
customerErased
Boolean!
Whether the customer was erased. Then the order's personal data reads null, never "none".
items
Arguments:
first:Intafter:Stringlast:Intbefore:String
The goods lines, by line number, then id.
- A connection, paged with
first/afterorlast/before, at most 250 a page. Its cursors belong to this order's items; any other connection refuses them. - A set is one item. The lines of its components, which are what is reserved, picked and
shipped, are not items here but the set's
components. - 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.
charges
Arguments:
first:Intafter:Stringlast:Intbefore:String
Everything on the order that is not goods, by line number, then id.
- A connection, paged with
first/afterorlast/before, at most 250 a page. Its cursors belong to this order's charges; 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.
blocked
Why no consignment of the order may proceed. Null when nothing blocks it.
exceptions
Arguments:
first:Intafter:Stringlast:Intbefore:String
The problems the order was created with that need a user in MAX, open and resolved, oldest first
(by createdAt, then id). Empty when there were none.
- A connection, paged with
first/afterorlast/before, at most 250 a page. Its cursors belong to this order's exceptions; 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
Arguments:
first:Intafter:Stringlast:Intbefore:String
The ids that other systems know the order by, sorted by external source code, then parent id
(none first), external id and the reference's own id. source and externalId above are one
of them: the one the request named, otherwise the oldest.
- A connection, paged with
first/afterorlast/before, at most 250 a page. Its cursors belong to this order's references; any other connection refuses them. - Read together with the order: requires the
order.readpermission, notintegration.read. Without it, null withFORBIDDEN_ROLEat its path. - When your API key is limited to partners other than the order's customer, null with
FORBIDDEN_SCOPE(extensions.scopePARTNER). - 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.
documents
Arguments:
first:Intafter:Stringlast:Intbefore:Stringkinds:[DocumentKind!]
The files attached to the order (attachDocument), oldest first. kinds narrows
the list to those kinds. Removed documents are left out.
- A connection, paged with
first/afterorlast/before, at most 250 a page. Its cursors belong to this order's documents; any other connection refuses them. - Requires the
order.readpermission. - 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.
changedAt
When the order's last event was published (see events). Null only for an order that was
never published.
fulfilments
Arguments:
first:Intafter:Stringlast:Intbefore:String
The order's fulfilments, oldest first. A fulfilment is what one warehouse sends of the order; an order shipped from two warehouses has two.
- Requires the
fulfilment.readpermission. Without it, null withFORBIDDEN_ROLEat its path. The rest of the order is returned. - Fulfilments in warehouses outside your API key's warehouse scope are left out.
A connection, paged with first/after or last/before, at most 250 a page. For the next
page, send the same query with after set to pageInfo.endCursor, while
pageInfo.hasNextPage is true.
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.
invoices
Arguments:
kinds:[InvoiceKind!]first:Intafter:Stringlast:Intbefore:String
The invoices linked to the order, newest issued first. kinds narrows the list: INVOICE for
invoices proper, ADVANCE, CREDIT_NOTE. Without kinds, every kind. totalCount counts the
same invoices.
- A connection, paged with
first/afterorlast/before, at most 250 a page. - Requires the
invoice.readpermission. Without it, null withFORBIDDEN_ROLEat its path, and the rest of the response is returned. - 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.
governingInvoice
The linked invoice that governs the order's invoice reference.
Of the linked issued invoices of kind INVOICE that are CREATED, not cancelled and have a
number, it is the one with the latest issue date (then the greatest id). While one governs:
- The order's
invoiceNumberandinvoiceExternalIdare its number and id. setSalesOrderInvoicerefuses another invoice (INVOICE_GOVERNED).
Null when none governs, or when the governing invoice is outside your API key's scope.
Requires the invoice.read permission. Without it, null with FORBIDDEN_ROLE at its path.
invoicePdfReady
Boolean
Whether the order's invoice has a PDF to send now: what the orderInvoice attachment of
sendEmail would find. Use it to wait before an invoice e-mail when the PDF
arrives later; a workflow does this with waitUntil on erpOrder.invoicePdfReady.
With a governing invoice, it is true when any of these exists:
- The accounting system's PDF attached to the invoice (
attachInvoiceDocument). - The order's document of the invoice's kind under the invoice's number. This counts on any order the invoice is linked to.
- MAX's own render, where the invoice's external source allows it
(
ExternalSource.invoicePrintAllowed). Then it istrueas soon as the invoice governs. A foreign-currency invoice synced without its home-currency VAT is still refused when sent (HOME_VAT_MISSING).
Without a governing invoice, it is true when the order has an INVOICE document.
- It is a fact of the order, not of your API key's permissions. Sending still requires the
read permissions that
sendEmaillists. - Null, with an error at its path, when it cannot be read. The rest of the order is returned.
- Costs 2 points.
shipments
Arguments:
first:Intafter:Stringlast:Intbefore:String
The order's carrier shipments, oldest first. Live and cancelled shipments are listed; a shipment that never reached the carrier is not.
- Requires the
shipment.readpermission. Without it, null withFORBIDDEN_ROLEat its path. - Shipments outside your API key's legal-entity or warehouse scope are left out.
A connection, paged with first/after or last/before, at most 250 a page.
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.