Question

I'm trying to post the following XML to the QB desktop SDK. When I do not include a QuantityOnHand or PurchaseCost node, the call is successful, but when either or both of these nodes are included, the call fails. Here's the XML I'm generating:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="12.0"?>
<QBXML>
  <QBXMLMsgsRq onError="continueOnError">
    <ItemInventoryAddRq>
      <ItemInventoryAdd>
        <Name>11200</Name>
        <IsActive>1</IsActive>
        <SalesDesc>R/C Glider.</SalesDesc>
        <SalesPrice>149.99000</SalesPrice>
        <PurchaseCost>124.99000</PurchaseCost>
        <QuantityOnHand>35</QuantityOnHand>
        <IncomeAccountRef>
          <FullName>Construction Income:Materials Income</FullName>
        </IncomeAccountRef>
        <COGSAccountRef>
          <FullName>Cost of Goods Sold</FullName>
        </COGSAccountRef>
        <AssetAccountRef>
          <FullName>Inventory Asset</FullName>
        </AssetAccountRef>
      </ItemInventoryAdd>
    </ItemInventoryAddRq>
  </QBXMLMsgsRq>
</QBXML>
Was it helpful?

Solution

With qbXML, the order of XML nodes IS IMPORTANT.

So, if the Intuit XSD/QuickBooks OSR tells you the order of nodes should be:

<SalesDesc >STRTYPE</SalesDesc> <!-- optional -->
<SalesPrice >PRICETYPE</SalesPrice> <!-- optional -->
<IncomeAccountRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</IncomeAccountRef>
<PurchaseDesc >STRTYPE</PurchaseDesc> <!-- optional -->
<PurchaseCost >PRICETYPE</PurchaseCost> <!-- optional -->
<COGSAccountRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</COGSAccountRef>
<PrefVendorRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</PrefVendorRef>
<AssetAccountRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</AssetAccountRef>
<ReorderPoint >QUANTYPE</ReorderPoint> <!-- optional -->
<QuantityOnHand >QUANTYPE</QuantityOnHand> <!-- optional -->

Then you MUST provide the nodes in that order.

In your case, you're sending QuantityOnHand before IncomeAccountRef, COGSAccountRef, etc., which will be rejected. Also note that PurchaseCost comes after the IncomeAccountRef node.

There's a bit more information on our QuickBooks integration wiki - FAQ section and our QuickBooks wiki in general.

Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top