I am trying to create SalesOrder through QBWebConnector (backend - Rails + qbwc), following Onscreen Reference for Intuit Software Development Kits, and it says that SalesOrderAdd requires only CustomerRef attribute, but QBXML validator says:
Line: 10
LinePos: 9
Src Text: </SalesOrderAdd>
Reason: Element content is incomplete according to the DTD/Schema.
Expecting: ClassRef, TemplateRef, TxnDate, RefNumber, BillAddress, ShipAddress, PONumber, TermsRef, DueDate, SalesRepRef, FOB, ShipDate.
QBXML Request is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderAddRq>
<SalesOrderAdd>
<CustomerRef>
<FullName>Test customer</FullName>
</CustomerRef>
</SalesOrderAdd>
</SalesOrderAddRq>
</QBXMLMsgsRq>
</QBXML>
Why is that? Can I change this behavior somehow (omit all tags except pointed as required in Onscreen Reference)?
The OSR is... less than perfect. But it does indicate there are additional required fields.
You need to add at least one line item or group line.
Related
I am trying to modify a sales order created in QB Desktop. But it gives me XML error
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Here is my XML Request
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="11.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderModRq>
<SalesOrderMod>
<TxnID>1-1672737866</TxnID>
<EditSequence>1672737866</EditSequence>
<CustomerRef>
<FullName>156004 Loose Bee Ln</FullName>
</CustomerRef>
<TxnDate>2023-01-03</TxnDate>
<BillAddress>
<Addr1>123</Addr1>
<Addr2></Addr2>
<City>Gity</City>
<State>Ritham</State>
<PostalCode>5555</PostalCode>
<Country>Universe</Country>
</BillAddress>
<PONumber>4444444</PONumber>
<Other>Southshore Bay</Other>
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
<ItemRef>
<FullName>Single Family - One Story</FullName>
</ItemRef>
<Desc>Foundation</Desc>
<Quantity>1</Quantity>
<Amount>85.00</Amount>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Lot</DataExtName>
<DataExtValue>8/98</DataExtValue>
</DataExtMod>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>Address</DataExtName>
<DataExtValue>156004 Loose Bee Ln</DataExtValue>
</DataExtMod>
</SalesOrderLineMod>
</SalesOrderMod>
</SalesOrderModRq>
</QBXMLMsgsRq>
</QBXML>
Any help is highly appreciatable..
Whenever you get this error:
0x80040400: QuickBooks found an error when parsing the provided XML text stream
It means you used an XML tag incorrectly, an unsupported XML tag, or an XML tag in the wrong order.
You can refer to the documentation to see what supported tags, their order, etc. are:
https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/salesordermod
At least at first glance, I can see that TxnID inside SalesOrderLineMod is not correct (maybe you meant TxnLineID instead?):
<SalesOrderLineMod>
<TxnID>3-1672737866</TxnID
It may also be worth double-checking those DataExtMod tags too.
I want to get sales order from Quickbook Desktop.
From Quickbook reference i am using Salesorderquery(2.1)
Below is the XML i am using
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderQueryRq metaData="ENUMTYPE" iterator="ENUMTYPE" iteratorID="UUIDTYPE"/>
</QBXMLMsgsRq>
</QBXML>
but when i try to test the xml request via SDKTESTPLUS3 i am getting below error
QuickBooks found an error when parsing the provided XML text stream.
Can you please tell me what i am doing wrong in this request.
You have a few problems here:
metaData="ENUMTYPE" - This is an enum (https://en.wikipedia.org/wiki/Enumerated_type), and ENUMTYPE is not a valid value for the enum. Either remove this attribute, or specify a valid type.
iterator="ENUMTYPE" - This is also an enum, same deal.
iteratorID="UUIDTYPE" - This is supposed to be a UUID. If you aren't continuing an iterator, you should leave this attribute out. Otherwise, use the UUID for the iterator.
Also, some versions of QuickBooks use an XML parser that doesn't like self-closed tags. Try this instead:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderQueryRq></SaalesOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>
I'm using Intuit QuickBooks Pro 2015.
With QBXMLRP2 and with the following XML file I can open the QuickBooks UI and prefill a new invoice with the desired customer, on this case: George Clooney.
<?xml version="1.0" ?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq requestID = "1">
<TxnDisplayAddType>Invoice</TxnDisplayAddType>
<EntityRef>
<FullName>George Clooney</FullName>
</EntityRef>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
Until here everything is OK.
My problem is that I need to add items to this invoice.
Then, I try something like:
<?xml version="1.0" ?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq requestID = "1">
<TxnDisplayAddType>Invoice</TxnDisplayAddType>
<EntityRef>
<FullName>George Clooney</FullName>
</EntityRef>
<InvoiceLineAdd>
<Desc>For the house</Desc>
<Quantity>1</Quantity>
<Rate>120.00</Rate>
</InvoiceLineAdd>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
but I get the following error:
Exception: QuickBooks found an error when parsing the provided XML text stream.
On the Programmer's Guide I don't find the way to do this:
https://developer-static.intuit.com/qbSDK-current/doc/PDF/QBSDK_ProGuide.pdf
Here are the available XML examples:
https://github.com/IntuitDeveloper/QBXML_SDK13_Samples/tree/master/xmlfiles/legacy
For my example I used specifically, the file: TxnDisplayAdd_Invoice.xml.
My question: How do I add items to this new invoice?
Thanks.
You should refer to the QuickBooks OSR for qbXML reference:
https://developer-static.intuit.com/qbsdk-current/common/newosr/index.html
The supported XML request nodes look like this:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDisplayAddRq>
<!-- TxnDisplayAddType may have one of the following values: Bill, BillPayment, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, VendorCredit -->
<TxnDisplayAddType >ENUMTYPE</TxnDisplayAddType> <!-- required -->
<EntityRef> <!-- optional -->
<ListID >IDTYPE</ListID> <!-- optional -->
<FullName >STRTYPE</FullName> <!-- optional -->
</EntityRef>
</TxnDisplayAddRq>
</QBXMLMsgsRq>
</QBXML>
In short - you can't do what you're trying to do. QuickBooks doesn't support it.
The only thing you can pre-fill is the entity (customer).
I have seen documention on iterration on QBSDK_ProGuid.pdf file(page 117).i am confusion how to issue the same query again and setting iterator value now set to Continue, and the IteratorID field set to the IteratorID value returned from the first query iteration.
<?xml version="1.0" ?>
<?qbxml version="5.0" ?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CustomerQueryRq requestID="5001" iterator="Continue"
iteratorID="{D7355385-A17B-4f5d-B34D-F34C79C3E6FC}">
<MaxReturned>10</MaxReturned>
<IncludeRetElement>ListID</IncludeRetElement>
</
CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>
I am following WCWebService sample which is provided by intuit... and getting customer data ..
can any one please provide a sample which is using iteration Concept.
Thanks !
Below is an example of using iterators to query for a customers, fetching five (5) customers at a time. This query fetches customers with the following criteria:
Modified after January 29th, 1984
OwnerID is 0 (this just makes sure we get back DataExt values (custom fields) defined in the GUI)
Your initial request will look as below. Notice that we declare the iterator=“Start” attribute to start our iterator:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="5.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<CustomerQueryRq requestID="1" iterator="Start">
<MaxReturned>5</MaxReturned>
<FromModifiedDate>1984-01-29T22:03:19</FromModifiedDate>
<OwnerID>0</OwnerID>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>
QuickBooks will send you back a response containing the first five (5) customers that looks like below. Notice that QuickBooks has sent us back an iteratorID="..." attribute and an iteratorRemainingCount="..." attribute, indicating the ID used to identify the iterator, and the number of items left in the iterator.
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<CustomerQueryRs
requestID="1"
statusCode="0"
statusSeverity="Info"
statusMessage="Status OK"
iteratorRemainingCount="18"
iteratorID="{eb05f701-e727-472f-8ade-6753c4f67a46}">
<CustomerRet>
<ListID>110000-1232697602</ListID>
<TimeCreated>2009-01-23T03:00:02-05:00</TimeCreated>
<TimeModified>2009-01-23T03:00:02-05:00</TimeModified>
<EditSequence>1232697602</EditSequence>
<Name>10th Customer</Name>
<FullName>10th Customer</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<Balance>0.00</Balance>
<TotalBalance>0.00</TotalBalance>
<SalesTaxCodeRef>
<ListID>10000-1232327562</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
<ItemSalesTaxRef>
<ListID>10000-1232327661</ListID>
<FullName>Out of State</FullName>
</ItemSalesTaxRef>
<JobStatus>None</JobStatus>
</CustomerRet>
... 4 more customer records will go here ...
</CustomerQueryRs>
</QBXMLMsgsRs>
</QBXML>
You'll then check the iteratorRemainingCount attribute and, if it's greater than 0, send your next request using the iteratorID attribute. Remember, every subsequent request request using this iterator must use the same search criteria and that search criteria must be sent with every request.
So, in this case, every request for the next part of the iterator will resend the <MaxReturned>, <FromModifiedDate>, and <OwnerID> elements. Notice that we send the returned iteratorID="..." attribute from the previous response, and declare the iterator="Continue" attribute indicating we want to continue fetching from an existing iterator:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="5.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<CustomerQueryRq
requestID="2"
iterator="Continue"
iteratorID="{eb05f701-e727-472f-8ade-6753c4f67a46}">
<MaxReturned>5</MaxReturned>
<FromModifiedDate>1984-01-29T22:03:19</FromModifiedDate>
<OwnerID>0</OwnerID>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>
This process will repeat until there are no more items left in the iterator. On each response, you'll check the iteratorRemainingCount attribute, and if it's greater than 0, you'll issue another request to get the next part of the iterator.
Eventually, you'll notice that the iteratorRemainingCount attribute will dwindle to zero (0) at which point you'll stop issuing requests, because the iterator has no more records to return. If you do issue another request, you'll get back an error as the iterator has, at this point, expired.
<?xml version=“1.0” ?>
<QBXML>
<QBXMLMsgsRs>
<CustomerQueryRs
requestID="5"
statusCode="0"
statusSeverity="Info"
statusMessage="Status OK"
iteratorRemainingCount="0"
iteratorID="{eb05f701-e727-472f-8ade-6753c4f67a46}">
<CustomerRet>
<ListID>1B0000-1232697643</ListID>
<TimeCreated>2009-01-23T03:00:43-05:00</TimeCreated>
<TimeModified>2009-01-23T03:00:43-05:00</TimeModified>
<EditSequence>1232697643</EditSequence>
<Name>Pat Daniels</Name>
<FullName>Pat Daniels</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<Balance>0.00</Balance>
<TotalBalance>0.00</TotalBalance>
<SalesTaxCodeRef>
<ListID>10000-1232327562</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
<ItemSalesTaxRef>
<ListID>10000-1232327661</ListID>
<FullName>Out of State</FullName>
</ItemSalesTaxRef>
<JobStatus>None</JobStatus>
</CustomerRet>
... 4 more customer records will go here ...
</CustomerQueryRs>
</QBXMLMsgsRs>
</QBXML>
I would like to get the ItemReceipt items that have LinkedTxn with the PurchaseOrder type.
Now I use the following query:
<?xml version="1.0" encoding="utf-8"?><?qbxml version="12.0"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<ItemReceiptQueryRq requestID="1">
<IncludeLineItems>true</IncludeLineItems>
<IncludeLinkedTxns>true</IncludeLinkedTxns>
<OwnerID>0</OwnerID>
</ItemReceiptQueryRq>
</QBXMLMsgsRq>
</QBXML>
The query returned all ItemReceipt items, and I filtred them on the client.
Could you tell me if there is a way to create a filter that returns only items that have LinkedTxn with the PurchaseOrder type?
The QuickBooks SDK does not support a way to create a filter that returns only items that have a LinkedTxn with a certain type.
You'll have to pull all of the transactions, and then filter them within your app.