Skip to main content

appCreatePurchaseOrder

Requires permission purchase:purchase_order:create.

Create a DRAFT purchase order from an installed app. Send the supplier and lines (variant, unit, quantity, and optionally the supplier's agreed unit cost); the server sets tax, totals, currency, rate and dates, and a person approves the order. Needs write_purchasing.

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:

mutation AppCreatePurchaseOrder($input: AppCreatePurchaseOrderInput!) {
appCreatePurchaseOrder(input: $input) {
id
orderNumber
supplierCode
trackingCode
creatorName
projectName
creditLimitOverride {
baseCurrency
limit
projected
}
}
}

Variables:

{
"input": {
"lines": [
{
"quantity": 0,
"uomId": "id",
"variantId": "id"
}
],
"supplierId": "id"
}
}

Response:

{
"data": {
"appCreatePurchaseOrder": {
"id": "id",
"orderNumber": "string",
"supplierCode": "string",
"trackingCode": "string",
"creatorName": "string",
"projectName": "string",
"creditLimitOverride": {
"baseCurrency": "string",
"limit": 0,
"projected": 0
}
}
}
}
appCreatePurchaseOrder(
input: AppCreatePurchaseOrderInput!
): PurchaseOrder!

Arguments​

appCreatePurchaseOrder.input ● AppCreatePurchaseOrderInput! non-null input​

The purchase order.

Type​

PurchaseOrder object​

A purchase order raised with a supplier.