Skip to main content

lastSalesOrder

Requires permission sales:sales_order:read.

The customer's most recent order that is neither draft nor cancelled, with its lines, for repeating an order. Returns null when the customer has no qualifying order. Needs the sales order read permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query LastSalesOrder($partnerId: ID!) {
lastSalesOrder(partnerId: $partnerId) {
id
customerPoNumber
orderNumber
sourceQuoteNumber
trackingNumber
creatorName
billingAddress {
postalCode
city
country
state
street1
street2
}
}
}

Variables:

{
"partnerId": "id"
}

Response:

{
"data": {
"lastSalesOrder": {
"id": "id",
"customerPoNumber": "string",
"orderNumber": "string",
"sourceQuoteNumber": "string",
"trackingNumber": "string",
"creatorName": "string",
"billingAddress": {
"postalCode": "string",
"city": "string",
"country": "string",
"state": "string",
"street1": "string",
"street2": "string"
}
}
}
}
lastSalesOrder(
partnerId: ID!
): SalesOrder

Arguments​

lastSalesOrder.partnerId ● ID! non-null scalar​

The ID of the customer.

Type​

SalesOrder object​

A confirmed demand from a customer to ship goods, usually converted from a quote. Moves through confirmation, shipment, invoicing and payment.