1
votes

I am using Excel VBA to access quickbooks locally. I have the code to pull all customers and parse the results as well as pull all invoices and parse the results. I can pull a particular customer based on RefID and a particular invoice the same way. What I am trying to do is pull all invoices for a particular customer but can't figure it out. Also the Quickbooks OSR doesn't seem to work for me. I have tried in different browsers but no matter what I do I can't scroll through the list of messages. Whenever I click on the up or down arrow of the list, the list disappears so the only detail I can see is for CreditMemoMod(3.0). This works to get a single invoice:

<InvoiceQueryRq requestID="2">
  <RefNumber>60522</RefNumber>
  <IncludeLineItems>true</IncludeLineItems>
</InvoiceQueryRq>

But this doesn't work to get all of them for the customer:

<InvoiceQueryRq requestID="2">
<CustomerRef>
  <ListID>'3000000-866741515'</ListID>
</CustomerRef>
<IncludeLineItems>true</IncludeLineItems>
</InvoiceQueryRq>

and several variations of it, but that doesn't seem to work. Any ideas?

Thanks a lot.

2

2 Answers

0
votes

Use either ListId or FullName.

IDTYPE STRTYPE

The ListID will not have a quote.

0
votes

The query was almost correct. 'laoche' forgot the <EntityFilter> tag. In QuickBooks to get invoices for a specific customer you need to use the following QBXML:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <InvoiceQueryRq >
            <EntityFilter>
                <!--<ListID >80000002-1508838192</ListID>-->
                <FullName>Will Smith</FullName>
            </EntityFilter>
        </InvoiceQueryRq>
    </QBXMLMsgsRq>
</QBXML>

All of the filtering capabilities are available on the consolibyte's repo.