Supplier
A supplier
is a master record in the Financials application that provides products or services that are necessary for a variety of business operations or consumer needs. It contains details such as the supplier's name, main contact, and physical address.
Supplier List
To obtain a list of supplier
records, the following GraphQL query may be utilised:
query (
$filter: SupplierFilterInput
$sort: [SupplierSortSortByInput!]
$after: String
) {
creditors {
masterRecords {
suppliers {
records(filter: $filter, sort: $sort, after: $after) {
items {
supplierDetails {
...SupplierDetails
}
summaryData {
...SummaryDetails
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
}
fragment SupplierDetails on SuppliersDetails {
primaryKey
uniqueId
code
name
onStop
notes
contactDetails {
...ContactDetails
}
addressDetails {
...AddressDetails
}
userSort {
...UserSortDetails
}
customFields {
...CustomFieldDetails
}
}
fragment SummaryDetails on SummaryData {
balance
currencyBalance
turnoverYTD
currencyTurnoverYTD
turnoverPtd
}
fragment ContactDetails on ContactDetails {
title
firstName
surname
salute
jobTitle
initials
contact
}
fragment AddressDetails on AddressDetails {
primaryKey
address
town
county
country
postCode
email
telephone
mobile
website
fax
invoiceAddressCode
deliveryAddressCode
statementEmail
}
fragment UserSortDetails on SupplierUserSort {
sortKey
userSort1
userSort2
userSort3
preferredPaymentMethod
}
fragment CustomFieldDetails on SupplierCustomFields {
userCharacters {
char1
char2
char3
char4
char5
char6
char7
char8
}
userNumbers {
number1
number2
number3
}
userDates {
date1
date2
date3
}
userFlags {
flag1
flag2
flag3
}
}
Using this query, you can tailor your results using the following features:
-
Filtering: The list of Supplier records can be filtered using the provided
filter
parameter. An example of this Filter can be found below:{
"filter": {
"name": {
"beginsWith": "The"
},
"onStop": {
"eq": false
}
}
} -
Grouping: To group supplier records, use the
group
parameter provided. For more details see Aggregation. -
Sorting: To order results use the
sort
parameter provided. For more details on ordering the results returned by the API, see Sorting. -
Pagination: This API endpoint returns 100 records per page. For more information on paging, see Pagination.
Create Supplier
To create a new Supplier, you can use the following GraphQL mutation:
mutation ($supplier: SupplierInput!) {
creditors {
masterRecords {
supplier {
create(supplier: $supplier) {
__typename
... on IntEntityId {
...IntEntityIdDetails
}
... on FailedValidation {
...FailedValidationDetails
}
... on UnexpectedError {
... UnexpectedErrorDetails
}
}
}
}
}
}
fragment IntEntityIdDetails on IntEntityId {
id
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}
Populate $supplier
with the actual information about the Supplier you want to create. Please refer to SupplierInput
GraphQL type in Api Reference.
Update Supplier
To update an existing Supplier, you can use the following GraphQL mutation:
mutation ($supplier: SupplierInput!) {
creditors {
masterRecords {
supplier {
update(supplier: $supplier) {
__typename
... on IntEntityId {
...IntEntityIdDetails
}
... on FailedValidation {
...FailedValidationDetails
}
... on UnexpectedError {
... UnexpectedErrorDetails
}
}
}
}
}
}
fragment IntEntityIdDetails on IntEntityId {
id
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}
Delete Supplier
To delete Suppliers by their ID, you can use the following GraphQL mutation:
mutation ($primaryKeys: [Int!]) {
creditors {
masterRecords {
supplier {
delete(primaryKeys: $primaryKeys) {
__typename
... on Succeeded {
... SucceededDetails
}
... on FailedValidation {
... FailedValidationDetails
}
... on UnexpectedError {
... UnexpectedErrorDetails
}
}
}
}
}
}
fragment SucceededDetails on Succeeded {
succeeded
}
fragment FailedValidationDetails on FailedValidation {
errors {
...ValidationItemDetails
}
warnings {
...ValidationItemDetails
}
}
fragment ValidationItemDetails on ValidationItem {
message
details {
primaryKey
field
value
}
}
fragment UnexpectedErrorDetails on UnexpectedError {
errorMessage
}