To give more information to receiving, you'll need to create a purchase order. A purchase order is a record of a purchase that you've made from a supplier. It's a way to track what you've ordered, when it's expected to arrive, and how much it will cost, and later when and in what condition purchased items arrive in.
Creating a Purchase Order
To create a purchase order, you'll need at least one product in your account.
Using the following mutation, you can create a purchase order:
mutation docsPurchaseOrderCreate($input: PurchaseOrderCreateInput!) {
purchaseOrderCreate(input: $input) {
ok
logs {
at
code
message
paths
severity
}
... on MutationFailure {
reason
code
}
... on MutationSuccess {
objects {
id
typename
}
}
}
}
In your request, pass at least the following input variables:
{
"input": {
"reference": "DOC_PO_TEST",
"lineItems": [
{
"productId": "1",
"unitPrice": { "amount": 9.99, "currency": "AUD" },
"quantity": 1
}
]
}
}
ℹ️ In the SDK,
.purchaseOrderCreate()
.
{
"data": {
"purchaseOrderCreate": {
"ok": true,
"logs": null,
"objects": [
{
"id": "1",
"typename": "PurchaseOrder"
},
{
"id": "2",
"typename": "LineItem"
}
]
}
}
}
If there was an issue it'll be explained in the response. If not, you now have a purchase order and a line item in your account.
The purchase order just created is in a very minimal state, and needs more information.
Such as when you're expecting the purchased items to arrive, and which location they'll arrive at.
Assuming you didn't pass any other input variables, you can do the following to update the purchase order with more information:
Such as which location the line items are expected to arrive at.
mutation docsPurchaseOrderLocationUpdate($input: PurchaseOrderLocationUpdateInput!) {
purchaseOrderLocationUpdate(input: $input) {
ok
logs {
at
code
severity
paths
message
}
... on MutationFailure {
code
reason
}
}
}
{
"input": {
"id": "1",
"orderedToId": "20"
}
}
This updates the purchase order with the location it's expected to arrive at. orderedToId
is a location id.
ℹ️ There are many other mutations to interact with purchase orders, all are available in the reference, schema, sdk, and playground, and begin with
purchaseOrder
!