What is the correct structure for adding MULTIPLE Time Activities in QBXML (Quickbooks Desktop API)? - quickbooks

When communicating with Quickbooks Desktop (via the Quickbooks Web Connector) from my web application, I can successfully add INDIVIDUAL time entries to Quickbooks using the following XML (QBXML) structure:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-22</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT1H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>
</QBXML>
For reference this conforms to the
Intuit API specification for TimeTrackingAdd requests.
HOWEVER, when I try to formulate a BATCH request (i.e. send multiple time entries in a single request) I get an error from Quickbooks:
"QuickBooks found an error when parsing the provided XML text stream."
The QBXML for my failing batch request is similar to the above: I simply repeat the <TimeTrackingAdd> section with another valid (individually working) time entry:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-22</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT1H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
<TimeTrackingAdd>
<TxnDate>2022-10-23</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT2H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Test Note</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>
</QBXML>
The QB XML Validator tool (provided in the QuickBooks SDK v15.0) is of little help. It validates the first individual transaction but chokes (I think internally) on the BATCH operation with "Error during validation: D, Conversion from string "Line: 31 LinePos: 21 Src Text:" to type 'Double' is not valid."
I thought that this was the correct way to batch requests - it seems that this approach is being used for 'ADD' requests on similar entities (like invoices).
I've hit my head on this for 2 days and can find no example anywhere on the web for a batch TimeTrackingAdd request or concrete information on how to batch Quickbooks Desktop 'Add' requests in general. I believe that it's important to batch these requests to efficiently process user timesheets and to provide timesheet atomicity, i.e. that if a timesheet fails ALL of the time-entries that it is comprised of will also not be created in Quickbooks - saving a potentially messy cleanup where some time-entries (within a single user weekly timesheet) succeed and others fail.
I will award points for a working QBXML sample or any comments that help me solve my problem.

I have found the answer to my own question with the help of 2 answers to related questions on stack overflow by Keith Palmer.
It seems that, for some entities like payments, multiple "ADD" requests, are repeated at the <ReceivePaymentAdd> level (i.e. not the <ReceivePaymentAddRq> parent level).
See: Adding Multiple Payments using QBXML
However, for other entities like sales orders, we make multiple "ADD" requests repeating the <SalesOrderAddRq> (parent) level (i.e. not the <SalesOrderAdd> child level). This appears to be the case for Time Tracking additions.
See: Multiple Orders in Sales Order Add request in qbxml
Any insights into what still appears to me as an QBXML inconsistency would be welcome!
Note also that the shape of the XML response loosely mirrors the shape of the request. Said another way, the Quickbooks response for a time-tracking ADD cannot be parsed in the same way as a time tracking QUERY - the response has a different XML hierarchy.
In case it helps other users (and for reference), here's a working example for adding multiple time entries:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="9.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-23</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT2H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-24</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT3H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-25</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT4H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-26</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT5H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-27</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT6H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="100">
<TimeTrackingAdd>
<TxnDate>2022-10-28</TxnDate>
<EntityRef>
<ListID>8000000F-1661995835</ListID>
</EntityRef>
<CustomerRef>
<ListID>80000007-1654551468</ListID>
</CustomerRef>
<ItemServiceRef>
<ListID>80000008-1654552326</ListID>
</ItemServiceRef>
<Duration>PT7H0M</Duration>
<PayrollItemWageRef>
<ListID>80000009-1654190217</ListID>
</PayrollItemWageRef>
<Notes>Startup Edmonton > Pre-design Notes</Notes>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>
</QBXML>

Related

QBXML InvoiceAdd Error 3250 Feature Not Enabled Or Available

I have been able to create basic invoices via the API with single line items. These have not shipping etc.
Now, when trying to add complete Invoice with the Shipping Line Item (Type = Other Charge). I am getting error 3250 - This feature is not enabled or not available in this version of QuickBooks.
QB Version: Enterprise 2018 Manufacturing Edition w/ Advanced Inventory
InvoiceAddRq Not Working
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="INV-CREATE|8000B526-1518041862">
<InvoiceAdd>
<CustomerRef>
<ListID>8000B526-1518041862</ListID>
</CustomerRef>
<TemplateRef>
<FullName>FS Invoice</FullName>
</TemplateRef>
<TxnDate>2018-02-07</TxnDate>
<PONumber>WEB-44364</PONumber>
<TermsRef>
<FullName>Prepaid</FullName>
</TermsRef>
<ItemSalesTaxRef>
<FullName>Sales Tax</FullName>
</ItemSalesTaxRef>
<Memo>Web Order Id: 44364</Memo>
<InvoiceLineAdd>
<ItemRef>
<FullName>Shipping Fees</FullName>
</ItemRef>
<Desc>Shipping Charges</Desc>
<Quantity>1.00</Quantity>
<Rate>8.95</Rate>
<Amount>8.95</Amount>
<SalesTaxCodeRef>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<ListID>80000086-1512586876</ListID>
</ItemRef>
<Desc>Product Description</Desc>
<Quantity>1.00</Quantity>
<Rate>22.99</Rate>
<Amount>22.99</Amount>
<InventorySiteLocationRef>
<FullName>RSM</FullName>
</InventorySiteLocationRef>
<SalesTaxCodeRef>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
Simple InvoiceAddRq Working
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="INV-CREATE|8000B543-1518105265">
<InvoiceAdd>
<CustomerRef>
<ListID>8000B543-1518105265</ListID>
</CustomerRef>
<TemplateRef>
<FullName>FS Invoice</FullName>
</TemplateRef>
<TxnDate>2018-02-08</TxnDate>
<PONumber>WEB-44380</PONumber>
<TermsRef>
<FullName>Prepaid</FullName>
</TermsRef>
<ItemSalesTaxRef>
<FullName>Out of State</FullName>
</ItemSalesTaxRef>
<Memo>Web Order Id: 44380</Memo>
<InvoiceLineAdd>
<ItemRef>
<FullName>WBQB-TMP</FullName>
</ItemRef>
<Desc>Temp Product Entry. Please enter data from WB.</Desc>
<Quantity>1.00</Quantity>
<Rate>1.00</Rate>
<Amount>1.00</Amount>
<SalesTaxCodeRef>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
I have tried searching the docs for some setting in QB I may need to change but have come up empty. Hoping someone can help with this.
This error is usually related to something you don't have turned on in QuickBooks.
If you were to create this same invoice in QuickBooks directly, would you be able to choose all of those options?
Have you tried creating an invoice with an absolute minimum of information? e.g. without the sales tax, without the inventory sites, without the template, without the sales terms, etc.?
I'd bet that you either:
Don't have sales tax enabled
or
Don't have inventory site location tracking enabled

qbxml QuickBooks XML BillAddress invalid according to DTD

Version 13.0 of qbxml. Why is the validator listing XML elements that are not in my XML and are not required as something it's expecting?
In all the references I've seen it lists Memo after BillAddress for InvoiceAdd.
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Line: 20
LinePos: 22
Src Text: <BillAddress>
Reason: Element content is invalid according to the DTD/Schema.
Expecting: ItemSalesTaxRef, Memo, CustomerMsgRef, IsToBePrinted, IsToBeEmailed, IsTaxIncluded, CustomerSalesTaxCodeRef, Other, Exchange....
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<InvoiceAddRq requestID="43">
<InvoiceAdd>
<CustomerRef>
<FullName>GORILLA SPRAY FOAM LLC</FullName>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2017-12-01</TxnDate>
<RefNumber>9690</RefNumber>
<PONumber>JN 102317</PONumber>
<ShipDate>2017-10-23</ShipDate>
<ShipMethodRef>
<FullName>x</FullName>
</ShipMethodRef>
<BillAddress>
<Addr1>GORILLA SPRAY FOAM LLC</Addr1>
<Addr2>2332 HIGHWAY 65</Addr2>
<City>MORA</City>
<State>MN</State>
<PostalCode>55051</PostalCode>
</BillAddress>
<InvoiceLineAdd>
<ItemRef>
<FullName>S 8000</FullName>
</ItemRef>
<Desc>x</Desc>
<Quantity>2</Quantity>
<Amount>x</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>S 8020</FullName>
</ItemRef>
<Desc>x</Desc>
<Quantity>2</Quantity>
<Amount>x</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>Delivery Charge</FullName>
</ItemRef>
<Desc>Delivery Charge</Desc>
<Amount>75.00</Amount>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>Sales Tax</FullName>
</ItemRef>
<Desc>Minnesota Sales Tax</Desc>
<Amount>2.58</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
The order of the tags in qbXML is important.
If the OSR shows, for example, that the ShipMethod, ShipDate, and PONumber tags come AFTER the BillAddress tag, then you MUST follow that order.
Refer to the OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Make sure your tags are in the correct order. Currently they are not due to the ShipDate, ShipMethodRef, and PONumber tags being prior to BillAddress.

Unable to update QuickBooks Offline Payment

I am sending this request to the QBSDK for updating a payment but getting an exception
"QuickBooks found an error when parsing the provided XML text stream."
.
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentModRq requestID="1">
<ReceivePaymentMod>
<TxnID>130-1503933149</TxnID>
<EditSequence>1503933149</EditSequence>
<CustomerRef>
<ListID>80000012-1503933114</ListID>
</CustomerRef>
<TxnDate>2017-08-28</TxnDate>
<PaymentMethodRef>
<FullName>Cash</FullName>
</PaymentMethodRef>
<AppliedToTxnMod>
<TxnID>12D-1503933135</TxnID>
<PaymentAmount>200.00</PaymentAmount>
</AppliedToTxnMod>
<TotalAmount>200.00</TotalAmount>
</ReceivePaymentMod>
</ReceivePaymentModRq>
</QBXMLMsgsRq>
</QBXML>
Can anyone suggest what is wrong with this xml request ?
The position of the TotalAmount tag in my xml request was the issue .
I solved it by putting it just below the PaymentMethodRef tag like this :
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentModRq requestID="1">
<ReceivePaymentMod>
<TxnID>130-1503933149</TxnID>
<EditSequence>1503933149</EditSequence>
<CustomerRef>
<ListID>80000012-1503933114</ListID>
</CustomerRef>
<TxnDate>2017-08-28</TxnDate>
<PaymentMethodRef>
<FullName>Cash</FullName>
</PaymentMethodRef>
<TotalAmount>200.00</TotalAmount>
<AppliedToTxnMod>
<TxnID>12D-1503933135</TxnID>
<PaymentAmount>200.00</PaymentAmount>
</AppliedToTxnMod>
</ReceivePaymentMod>
</ReceivePaymentModRq>
</QBXMLMsgsRq>
</QBXML>

How to open the QuickBooks Desktop UI and prefill an invoice with items?

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).

Quickbooks Sales Receipt add error

There was an error when saving a SalesReceipt. QuickBooks error
message: Transaction amount must be positive.
When I submit this xml to my quickbooks webconnector it throws me the above error. What is the transaction amount and where in the xml does it go?
<?xml version="1.0" encoding="utf-16"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesReceiptAddRq requestID="1">
<SalesReceiptAdd>
<CustomerRef>
<FullName>Daily Sales Summary</FullName>
</CustomerRef>
<TemplateRef>
<FullName>Custom Sales Receipt</FullName>
</TemplateRef>
<SalesReceiptLineAdd>
<ItemRef>
<FullName>Food</FullName>
</ItemRef>
<Desc>Total Food Sales</Desc>
<Amount>50.00</Amount>
</SalesReceiptLineAdd>
</SalesReceiptAdd>
</SalesReceiptAddRq>
</QBXMLMsgsRq>
</QBXML>
Need item for SalesReceiptLineAdd
Something like that:
<SalesReceiptAddRq requestID="2"><SalesReceiptAdd><CustomerRef><FullName>Dang Dinh*</FullName></CustomerRef><TxnDate>2013-11-15</TxnDate><CheckNumber/><PaymentMethodRef><FullName>Check</FullName></PaymentMethodRef><Memo>Test</Memo><IsToBePrinted>False</IsToBePrinted<SalesReceiptLineAdd><ItemRef><FullName>Sales</FullName></ItemRef><Desc>Test</Desc><Quantity>1</Quantity><Rate>1</Rate></SalesReceiptLineAdd></SalesReceiptAdd></SalesReceiptAddRq>

Resources