Search code examples
quickbooksqbxml

Quickbooks QBXML - how to exclude fields


I want to get all inventory items from quickbooks with only full name and quantity on hand fields, in order to get a smaller xml. Do you know how to achieve this?

This is the xml query request:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="10.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <ItemInventoryQueryRq>
        </ItemInventoryQueryRq>
    </QBXMLMsgsRq>
</QBXML>

Solution

  • You can use this tag to pick specifically which fields you want to include:

    <IncludeRetElement>

    For example, this gets invoices, but only the TxnID, EditSequence, and RefNumber fields:

    <?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="8.0"?>
    <QBXML>
      <QBXMLMsgsRq onError="stopOnError">
        <InvoiceQueryRq requestID="abcd1234">
    
          <TxnID>ABCD-1234</TxnID>
    
          <IncludeRetElement>TxnID</IncludeRetElement>
          <IncludeRetElement>EditSequence</IncludeRetElement>
          <IncludeRetElement>RefNumber</IncludeRetElement>
    
        </InvoiceQueryRq>
      </QBXMLMsgsRq>
    </QBXML>
    

    Example from this wiki:

    You may also want to reference Intuit's documentation which shows this, the QuickBooks OSR: