quickbooksqbxmlqbwc

SalesOrderQuery in QuickBooks Desktop does not returning Items of SalesOrder


I am making SalesOrderQuery to fetch Sales Orders created in Quickbooks Desktop Enterprise Version 18.0.

I have created some sales orders in QB Desk and querying for them but, I can not find sales orders items that I have added while creating order.

The OSR shows me that SalesOrderQueryRs will contain SalesOrderLineRet that I am assuming is item list of that order.

OSR ( https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html )

This is my sample query :

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <SalesOrderQueryRq requestID="2">
        </SalesOrderQueryRq>
    </QBXMLMsgsRq>
</QBXML>

And this is the resp that I am getting that does not have Item List included :

<?xml version="1.0" ?>
<QBXML>
    <QBXMLMsgsRs>
        <SalesOrderQueryRs requestID="3" statusCode="0" statusMessage="Status OK" statusSeverity="Info">
            <SalesOrderRet>
                <TxnID>2672D-1671085403</TxnID>
                <TimeCreated>2022-12-15T06:23:23+00:00</TimeCreated>
                <TimeModified>2022-12-15T06:23:23+00:00</TimeModified>
                <EditSequence>1671085403</EditSequence>
                <TxnNumber>1778</TxnNumber>
                <CustomerRef>
                    <ListID>800000D0-1182061376</ListID>
                    <FullName>Allard, Robert</FullName>
                </CustomerRef>
                <TemplateRef>
                    <ListID>120000-1071512690</ListID>
                    <FullName>Custom Sales Order</FullName>
                </TemplateRef>
                <TxnDate>2022-12-15</TxnDate>
                <RefNumber>7005</RefNumber>
                <BillAddress>
                    <Addr1>Robert Allard</Addr1>
                    <Addr2>92834 Chandler St.</Addr2>
                    <City>Millbrae</City>
                    <State>CA</State>
                    <PostalCode>94030</PostalCode>
                </BillAddress>
                <BillAddressBlock>
                    <Addr1>Robert Allard</Addr1>
                    <Addr2>92834 Chandler St.</Addr2>
                    <Addr3>Millbrae, CA 94030</Addr3>
                </BillAddressBlock>
                <ShipAddress>
                    <Addr1>Robert Allard</Addr1>
                    <Addr2>92834 Chandler St.</Addr2>
                    <City>Millbrae</City>
                    <State>CA</State>
                    <PostalCode>94030</PostalCode>
                </ShipAddress>
                <ShipAddressBlock>
                    <Addr1>Robert Allard</Addr1>
                    <Addr2>92834 Chandler St.</Addr2>
                    <Addr3>Millbrae, CA 94030</Addr3>
                </ShipAddressBlock>
                <PONumber>123456</PONumber>
                <DueDate>2022-12-15</DueDate>
                <ShipDate>2022-12-15</ShipDate>
                <Subtotal>192.00</Subtotal>
                <ItemSalesTaxRef>
                    <ListID>2E0000-933272656</ListID>
                    <FullName>San Tomas</FullName>
                </ItemSalesTaxRef>
                <SalesTaxPercentage>7.75</SalesTaxPercentage>
                <SalesTaxTotal>14.88</SalesTaxTotal>
                <TotalAmount>206.88</TotalAmount>
                <IsManuallyClosed>false</IsManuallyClosed>
                <IsFullyInvoiced>false</IsFullyInvoiced>
                <CustomerMsgRef>
                    <ListID>8000000A-1671085397</ListID>
                    <FullName>Test Order 2 having Wood Doors in order.</FullName>
                </CustomerMsgRef>
                <IsToBePrinted>true</IsToBePrinted>
                <IsToBeEmailed>false</IsToBeEmailed>
                <CustomerSalesTaxCodeRef>
                    <ListID>10000-999022286</ListID>
                    <FullName>Tax</FullName>
                </CustomerSalesTaxCodeRef>
            </SalesOrderRet>
        </SalesOrderQueryRs>
    </QBXMLMsgsRs>
</QBXML>

Is there any mistake in my QBXML request or anything else needed for this ?


Solution

  • The SalesOrderQuery request type supports a few optional flags you can pass in to adjust what you get back in the responses.

    Specifically:

    <IncludeLineItems >BOOLTYPE</IncludeLineItems> <!-- optional -->
    <IncludeLinkedTxns >BOOLTYPE</IncludeLinkedTxns> <!-- optional -->
    

    In your case, if you want line items then you should add this to your query:

    <IncludeLineItems>true</IncludeLineItems>
    

    And then you'll get back the <SalesOrderLineRet> nodes you're expecting.