My Products
Help
iizy
CONTRIBUTOR ***

Fetching open customer entries fails

by iizy

Hi,

We're not able to fetch open entries from GraphQL due to the following issues:

 

[
{
"Locations": null,
"Message": "Error: Failed to execute operation.",
"Path": [
"useCompany",
"openCustomerEntry",
"items",
0,
"joinup_Order"
],
"Extensions": {
"data": {
"status": 5,
"status_name": "failedToExecuteOperation"
}
}
},
{
"Locations": null,
"Message": "Error: SQL command no. 3014 failed.",
"Path": [
"useCompany",
"openCustomerEntry",
"items",
0,
"joinup_Order"
],
"Extensions": {
"data": {
"status": 2,
"status_name": "databaseError"
}
}
}
]

 

The query:

Variables: {
"voucherDateAsDate": null,
"companyId": *,
"nextPageCursor": null
}
query GetUnpaidInvoices($companyId: Int, $nextPageCursor:String) {
useCompany(no: $companyId) {
openCustomerEntry(filter: { _and: [ { orderNo: { _not_eq: 0 } } ],}after:$nextPageCursor
) {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
items {
amountInCurrency
debitAmountInCurrency
creditAmountInCurrency
invoiceAmountInCurrency
outstandingAmountInCurrency
debitOutstandingAmountInCurrency
creditOutstandingAmountInCurrency
cashAmountInCurrency
fixedAmountInCurrency
partPaymentInCurrency
outstandingCashAmountInCurrency
vatAmountInCurrency
voucherJournalNo
customerNo
voucherNo
voucherDateAsDate
valueDateAsDate
voucherType
text
dueDateAsDate
paidLastAsDate
orderNo
invoiceNo
reference
crossReference
turnover
paidStatus
generalLedgerAccountNo
changedByUser
paymentTerms
cashDueDateAsDate
employeeNo
additionalText
transactionStatus
deliveryAssociateNo
paymentMethod
externalReference1
externalReference2
paymentNo
cid
originalDueDate
originalDueDateAsDate
currencyCorrectionExchangeRate
currencyCorrectionAmount
currencyCorrectionDateAsDate
bankAccount
createdByUser
autopayPaymentReference
originalVoucherNo
changedDateTime
createdDateTime
amountDomestic
vatAmountDomestic
outstandingAmountDomestic
noReminders
joinup_Country {
isoCode
name
}
joinup_Currency {
currencyNo
isoCode
name
}
joinup_GeneralLedgerAccount {
accountNo
name
taxCode
}
joinup_Country {
isoCode
name
}
joinup_VoucherType {
voucherType
defaultText
}joinup_Order {
customerNo
invoiceCustomerNo
totalDiscountPercent
orderPreferences
name
addressLine1
addressLine2
addressLine3
addressLine4
postCode
postalArea
deliveryName
deliveryAddress1
deliveryAddress2
deliveryAddress3
deliveryAddress4
deliveryPostCode
deliveryPostalArea
deliveryTerms
deliveryMethod
paymentTerms
paymentMethod
factoringNo
sellerOrBuyer
roundingDomestic
roundingInCurrency
joinup_Associate_via_InvoiceCustomer {
title
companyNo
emailAddress
phone
privatePhone
mobilePhone
}
joinup_PaymentTerms {
creditDays
creditMonths
}
joinup_Country {
isoCode
name
}
joinup_Country_via_DeliveryCountry {
isoCode
name
}
}joinup_Associate_via_Customer {
externalId
invoiceCustomerNo
customerNo
factoringCompanyNo
name
title
companyNo
emailAddress
phone
privatePhone
mobilePhone
addressLine1
addressLine2
addressLine3
addressLine4
postCode
postalArea
visitPostCode
visitPostalArea
countryNo
deliveryMethodForCustomer
deliveryTermsForCustomer
paymentTermsForCustomer
paymentMethodForCustomer
currencyNo
generalLedgerAccountNoForCustomer
yourReference
customerPreferences1
joinup_Country {
isoCode
name
}
}
}
}
}
}

 

Do you know what is the root cause?

 

4 REPLIES 4
Accepted solution
omelhus
PARTNER

by omelhus

I think your issue is with how the API optimizes these queries. Try just setting the first-parameter to something sensible, like 500.

 

omelhus_0-1725617426722.png

 

KamilBronowskiIizy
CONTRIBUTOR **

Yes, it helped. 🙂

omelhus
PARTNER

by omelhus

Or you can try setting unoptimized: true, but the query might run into a timeout then. Finding the golden number for pagination is probably better.

Arnstein By
VISMA

by Arnstein By

@iizy Please provide a trace ID and we can have a look to find out what is going on.