Purchase Order Transactions
This document provides an overview of the operations available for the Purchase Order (purchasing) Transactions business entity. Please note that the queries shown below only present a subset of the fields.
For a full list of fields, please refer to our schema documentation provided within our API. See Explore the API.
Mutations
Create Purchase Order Transactions
To create new Purchase Order transactions within a Financials or Dimensions database, the Transaction create endpoints can be used. These endpoints allow the creation of Purchase Order
, Purchase Credit Note
and Purchase Request
transactions.
Request
Here's an example of how you can use the create
mutation:
- Purchase Order
- Purchase Credit Note
- Purchase Request
mutation ($transaction: PurchaseOrderInput!) {
purchasing {
transactions {
purchaseOrder {
create(purchaseOrder: $transaction) {
... on PurchaseOrderWriteResult {
...purchaseOrderWriteResultDetails
}
... on FailedValidation {
...FailedValidationDetails
}
... on UnexpectedError {
...UnexpectedErrorDetails
}
}
}
}
}
}
fragment purchaseOrderWriteResultDetails on PurchaseOrderWriteResult {
orderNumber
documentPrimary
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}
mutation ($transaction: PurchaseOrderInput!) {
purchasing {
transactions {
purchaseCreditNote {
create(purchaseCreditNote: $transaction) {
... on purchaseOrderWriteResult {
...purchaseOrderWriteResultDetails
}
... on FailedValidation {
...FailedValidationDetails
}
... on UnexpectedError {
...UnexpectedErrorDetails
}
}
}
}
}
}
fragment purchaseOrderWriteResultDetails on purchaseOrderWriteResult {
orderNumber
documentPrimary
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}
mutation ($transaction: PurchaseOrderInput!) {
purchasing {
transactions {
purchaseRequest {
create(purchaseRequest: $transaction) {
... on purchaseOrderWriteResult {
...purchaseOrderWriteResultDetails
}
... on FailedValidation {
...FailedValidationDetails
}
... on UnexpectedError {
...UnexpectedErrorDetails
}
}
}
}
}
}
fragment purchaseOrderWriteResultDetails on purchaseOrderWriteResult {
orderNumber
documentPrimary
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}
When you execute the create
mutation, it performs several steps to create new transactions:
-
Running business validations: The API performs a number of business validations on the input data to ensure that it meets the required criteria. These validations can include checks for things like valid Supplier information, correct gross amount, and any other business rules specific to your application. If any validation errors occur, the mutation will return a response with the details of the errors.
-
Calculating missing information: If any required information is missing from the input object, the mutation will calculate the missing values based on default settings or any other logic defined in the system. This ensures that the transaction has all the necessary data before it is created.
-
Saving the transaction: If all the necessary information is present and the business validations pass successfully, the mutation will save the transaction in the system and make it available for further processing or retrieval.
Response
After executing the create
mutation, you will receive a response containing the ID of the transaction if the creation was successful. If any validation errors or unexpected errors occur during the operation, the response will include the details of those errors.
An example of the three response types provided by this request can be found below:
- Success
- Validation
- Unexpected Error
{
"data": {
"purchasing": {
"transactions": {
"purchaseOrder": {
"create": {
"orderNumber": "3035",
"documentPrimary": 120
}
}
}
}
}
}
{
"data": {
"purchasing": {
"transactions": {
"purchaseOrder": {
"create": {
"errors": [
{
"message": "No text has been supplied for a text line!",
"details": []
}
],
"warnings": []
}
}
}
}
}
}
{
"data": {
"purchasing": {
"transactions": {
"purchaseOrder": {
"create": {
"Unexpected error message"
}
}
}
}
}
}
Queries
Get Outstanding Purchase Orders
To retrieve information about a specific outstanding Purchase Order transaction, you can use the purchasing\transactions\outstandingPurchaseOrders
queries. These queries will return all header and detail values for outstanding order transactions
Here's an example of how you can use the purchasing\transactions\outstandingPurchaseOrders\header
query to get the details of a Outstanding Purchase Order transactions:
- Request
- Response
query {
purchasing {
transactions {
outstandingPurchaseOrders {
header {
items {
orderNumber
orderType
orderStatus
accountCode
accountName
orderDate
orderGross
netOutstanding
periodNumber
yearLink
yearLabel
requiredDate
completionDate
auditNo
enteredBy
exchangeRate
batchRef
currencyGross
currencyNetOutstanding
currencySymbol
deliveryAccountCode
orderDescription
userSort1
userSort2
userSort3
subLedger
}
}
}
}
}
}
{
"data": {
"purchasing": {
"transactions": {
"outstandingPurchaseOrders": {
"header": {
"items": [
{
"orderNumber": "5000",
"orderType": "Order",
"orderStatus": "Outstanding",
"accountCode": "GB-S-1225",
"accountName": "Hendrerit Industries",
"orderDate": "2023-05-17T00:00:00",
"orderGross": 1065.24,
"netOutstanding": 887.7,
"periodNumber": 11,
"yearLink": 12,
"yearLabel": "2023",
"requiredDate": "2023-05-22T00:00:00",
"completionDate": null,
"auditNo": 1,
"enteredBy": "SA",
"exchangeRate": 0,
"batchRef": "",
"currencyGross": 0,
"currencyNetOutstanding": 0,
"currencySymbol": "GBP",
"deliveryAccountCode": "GB-S-1225",
"orderDescription": "",
"userSort1": "",
"userSort2": "",
"userSort3": "",
"subLedger": null
}
]
}
}
}
}
}
}
In the above query, you can customize the parameters $first
, $sort
, and $filter
to retrieve the desired number of results, apply sorting based on specific fields, and filter the transactions based on certain conditions.
$first
: Specifies the maximum number of results to retrieve.$sort
: Specifies the sorting order for the results based on specific fields.$filter
: Specifies the conditions to filter the transactions.
The response will include an array of transaction headers, each containing various fields such as account code, account name, transaction date, etc.
To retrieve detailed information about Purchase Order Lines, you can use the details
field within the purchasing\transactions\outstandingPurchaseOrders
query. This field requires the following input parameters:
query {
purchasing {
transactions {
outstandingPurchaseOrders {
details {
items {
analysisCode
analysisName
subAnalysis
description
quantityOrdered
quantityDelivered
quantityInvoiced
gross
netOutstanding
costPrice
lineDiscount
projectCode
projectName
costCentreCode
detail
auditNo
requiredDate
accountCode
costCentreName
accountName
accountSortKey
accountUserSort1
accountUserSort2
accountUserSort3
currencySymbol
currencyGross
currencyNetOutstanding
currencyCostPrice
currencyLineDiscount
headerUserSort1
headerUserSort2
headerUserSort3
itemName
itemCode
orderNumber
transactionUserKey1
transactionUserKey2
transactionUserKey3
transactionUserKey4
transactionUserKey5
taxCode
taxRate
}
}
}
}
}
}
Get Outstanding Purchase Order Credit Notes
To retrieve information about the outstanding Purchase Order Credit Note transactions present in a Financials database, you can use the purchasing\transactions\outstandingpurchaseCreditNote
queries. These queries will return all header and detail values for outstanding transactions
Here's an example of how you can use the purchasing\transactions\outstandingpurchaseCreditNote\header
query to get the details of a Outstanding Purchase Credit Note transactions:
- Request
- Response
query {
purchasing {
transactions {
outstandingCreditNotes {
header {
items {
orderNumber
orderType
orderStatus
accountCode
accountName
orderDate
orderGross
netOutstanding
periodNumber
yearLink
yearLabel
requiredDate
completionDate
auditNo
enteredBy
exchangeRate
batchRef
currencyGross
currencyNetOutstanding
currencySymbol
deliveryAccountCode
orderDescription
userSort1
userSort2
userSort3
subLedger
}
}
}
}
}
}
{
"data": {
"purchasing": {
"transactions": {
"outstandingCreditNotes": {
"header": {
"items": [
{
"orderNumber": "5014",
"orderType": "CreditNote",
"orderStatus": "Outstanding",
"accountCode": "1",
"accountName": "abc123",
"orderDate": "2024-09-10T00:00:00",
"orderGross": -30,
"netOutstanding": -25,
"periodNumber": 3,
"yearLink": 14,
"yearLabel": "2025",
"requiredDate": "2024-09-15T00:00:00",
"completionDate": null,
"auditNo": 15,
"enteredBy": "IU1",
"exchangeRate": 0,
"batchRef": "",
"currencyGross": 0,
"currencyNetOutstanding": 0,
"currencySymbol": "GBP",
"deliveryAccountCode": "*Company",
"orderDescription": "",
"userSort1": "ABC123",
"userSort2": "US2-B",
"userSort3": "",
"subLedger": "AC-PAY"
}
]
}
}
}
}
}
}
In the above query, you can customize the parameters $first
, $sort
, and $filter
to retrieve the desired number of results, apply sorting based on specific fields, and filter the transactions based on certain conditions.
$first
: Specifies the maximum number of results to retrieve.$sort
: Specifies the sorting order for the results based on specific fields.$filter
: Specifies the conditions to filter the transactions.
The response will include an array of transaction headers, each containing various fields such as account code, account name, transaction date, etc.
To retrieve detailed information about Purchase Order Lines, you can use the details
field within the purchasing\transactions\outstandingPurchaseOrders
query. This field requires the following input parameters:
query {
purchasing {
transactions {
outstandingCreditNotes {
details {
items {
analysisCode
analysisName
subAnalysis
quantityOrdered
quantityDelivered
quantityInvoiced
gross
costPrice
lineDiscount
projectCode
projectName
costCentreCode
detail
auditNo
requiredDate
costCentreName
currencyGross
currencyNetOutstanding
currencyCostPrice
currencyLineDiscount
itemName
itemCode
orderNumber
transactionUserKey1
transactionUserKey2
transactionUserKey3
transactionUserKey4
transactionUserKey5
taxCode
taxRate
}
}
}
}
}
}