user2096827
user2096827

Reputation: 13

Invoice query always returning no more than 10 results

Using IPP Java DevKit 2.0.9 (also tried with 2.0.6), I've implemented a wrapper method for finding specific invoices in QBO by customer ID and occurring before a certain date. I'm testing with a particular customer who has 65 invoices across ~16 months, but the query always returns the 10 "latest" invoices occurring before dateFinish (endTransactionDate). I've tried various permutations as well: only including the customer ID criteria, only including the endTransactionDate, adding a "really early" startTransactionDate, development version, and production version. It's as if the API is chopping off the results list and only including the first 10 records, seemingly without a good reason.

public static List<QBInvoice> findInvoices(PlatformSessionContext context, String dataSource, Calendar dateFinish, List<String> customerIds) throws QBInvalidContextException, Exception {
    QBInvoiceService invoiceService = QBServiceFactory.getService(context, QBInvoiceService.class);
    QBInvoiceQuery invoiceQuery = new QBInvoiceQuery(context);
    invoiceQuery.setEndTransactionDate(QuickbooksUtil.dateToQbDate(dateFinish));
    if (!customerIds.isEmpty()) {
        IdSet idSet = QuickbooksUtil.stringListToIdSet(context, dataSource, customerIds);
        invoiceQuery.setContactIdSet(idSet);
    }
    return invoiceService.getInvoices(context, invoiceQuery);
}

Upvotes: 1

Views: 128

Answers (1)

Peter Lavelle
Peter Lavelle

Reputation: 1484

Specify the PageNum and ResultsPerPage in your request. You are being returned the default, which is Page=1 and ResultsPerPage=10.

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/0100_Calling_Data_Services/0030_Retrieving_Objects#Paging

Upvotes: 3

Related Questions