|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
|
| Error inserting sales order, Element 'ItemRef' is not valid for content model |
| Author |
Message |
|
|
| Posted : 2009-07-18 13:42:14 |
Hi there,
I am having trouble inserting sales order lines as per: How do I create a Sales Order using QODBC?
QODBC Ver: 9.00.00.261 Quickbooks 2009/10 Enterprise wholesale and manufacturing.
Sample Insert I am using INSERT into salesorderline (SalesOrderLineQuantity, SalesOrderLineRate, SalesOrderLineAmount, CustomerRefListID, TemplateRefListID, SalesOrderLineItemRefListID, SalesOrderLineDesc, SalesOrderLineSalesTaxCodeRefListID, FQSaveToCache, RefNumber) VALUES (2, 24.98, 49.96, '80000880-1239173053', 'A0000-1108154785', '80000377-1232503086', 'Womens Compression Sports Bra Black 08', '80000005-1231236469', 0, '5936')
I am getting Element 'ItemRef' is not valid for content model [QODBC] Error parsing complete XML return string.
select * from item where listid = '80000377-1232503086' does returns a row.
QODBCLOG.txt ------------------- 2009-07-18 13:18:22 QODBC Ver: 9.00.00.261 ********************************************************************************************************************* IsAService: False SQL Statement: INSERT into salesorderline (SalesOrderLineQuantity, SalesOrderLineRate, SalesOrderLineAmount, CustomerRefListID, TemplateRefListID, SalesOrderLineItemRefListID, SalesOrderLineDesc, SalesOrderLineSalesTaxCodeRefListID, FQSaveToCache, RefNumber) VALUES (2, 24.98, 49.96, '80000880-1239173053', 'A0000-1108154785', '80000377-1232503086', 'Womens Compression Sports Bra Black 08', '80000005-1231236469', 0, '5936') Error parsing complete XML return string (8) Input XML: <?xml version="1.0" encoding="ISO-8859-1"?> <?qbxml version="6.1"?> <QBXML> <QBXMLMsgsRq onError = "continueOnError" responseData = "includeAll"> <SalesOrderAddRq requestID = "1"> <SalesOrderAdd defMacro = "TxnID:0A13E8A7-37CD-4566-A9AA-31B956DC0685"> <CustomerRef> <ListID>80000880-1239173053</ListID> </CustomerRef> <TemplateRef> <ListID>A0000-1108154785</ListID> </TemplateRef> <RefNumber>5936</RefNumber> <SalesOrderLineAdd> <Amount>49.96</Amount> <SalesTaxCodeRef> <ListID>80000005-1231236469</ListID> </SalesTaxCodeRef> <ItemRef> <ListID>80000377-1232503086</ListID> </ItemRef> <Desc>Womens Compression Sports Bra Black 08</Desc> <Quantity>2.00000</Quantity> </SalesOrderLineAdd> </SalesOrderAdd> </SalesOrderAddRq> </QBXMLMsgsRq> </QBXML> ---------------------
QBSDK.log ---------- 20090718.131822 I 2976 QBSDKProcessRequest Application named 'FLEXquarters QODBC' finishing requests (process 3780), ret = 1. 20090718.131822 E 3780 RequestProcessor Process Request error = 80042500, There was an error when parsing the provided XML file. 20090718.131822 I 2976 QBSDKProcessRequest Application named 'FLEXquarters QODBC' starting requests (process 3780). 20090718.131822 E 2976 XercesSAXErrorHandler Element 'ItemRef' is not valid for content model: '(ItemRef?,Desc?,Quantity?,((Rate|RatePercent|PriceLevelRef))?,ClassRef?,Amount?,TaxAmount?,SalesTaxCodeRef?,IsManuallyClosed?,Other1?,Other2?,DataExt*)' -- error at line 7, column 420 in XML data. 20090718.131822 I 2976 MsgSetHandler Parser error, finishing. --------
Second Question: Refnumber seems to be the sales order number, is it possible to leave this out of the query so it is autogenerated? And if so, can we retrieve it after the inserts?
Kind Regards Robert Stanford |
|
|
|
|
|
| Posted : 2009-07-20 10:19:30 |
Is this the only item you get this error with? A "Element 'ItemRef' is not valid for content model" error generally doesn't mean it's not a valid item, it actual means that QuickBooks is saying to you that you can't create a sales line using that item for a reason. Try raising a sales order using the item using the QuickBooks User Interface to see what the real error is.
If the RefNumber column and value is left out of the statement, QuickBooks will auto-increment the RefNumber from the last numeric Sales Order Number.
To retrive the RefNumber I would do something like:
Select Top 1 RefNumber from SalesOrder UNOPTIMIZED where CustomerRefListID='80000880-1239173053' Order by CustomerRefListID, TimeCreated DESC
after you have created the SalesOrder.
|
|
|
|
|
|
| Posted : 2009-07-23 19:58:20 |
Fixed,
I had SalesOrderLineSalesTaxCodeRefListID instead of SalesOrderLineTaxCodeRefListID
also I noticed it helps if I have all the fields in the same order as the example.
Robert |
|
|
|
|
|
| Posted : 2009-07-23 20:26:51 |
Thanks for letting me know the resolution however it does worry me because SalesOrderLineSalesTaxCodeRefListID is actually the right column name to use with QuickBooks 2009/10 and is the USA default. Intuit Canada took out the "Sales" part making it just SalesOrderLineTaxCodeRefListID because GST isn't Sales Tax and it's been that way for QuickBooks 2003, 2004, 2005/06, 2006/07 and 2007/08 in Australia. For QuickBooks QBi 2008/09, Reckon took the USA version of QuickBooks 2007 and went back to using "Sales" Tax because it's a real big pain to take the "Sales" part out of all the code.
At my suggestion I convinced the QODBC Software Engineer to keep both SalesOrderLineSalesTaxCodeRefListID and SalesOrderLineTaxCodeRefListID columns in tables so the columns could be used interchangable in code. It looks like there are still some internal mapping errors in QODBC 9.00.00.261.
The order of the INSERT columns should always be in the same order as the order of the columns of the table being inserted or updated.
|
|
|
|
|
Copyright (c) 2006-2009 Data Access Worldwide,
Australia. This FREE self help forum website
was copied by FLEXquarters.com Limited, Hong Kong to: http://archive.qodbc.com /forum50f5.html without our
permission. |
The QDeveloper Forum is
dedicated to the FREE professional exchange of
information. QODBC and FlexODBC users can post support
queries, report product bugs, or simply search topics
for help. Data Access Worldwide - Asia Pacific normal office
business hours are 9am to 5pm
week
days
Australian EST with the exception of Public Holidays.

ABN: 86 544 223 459
PO Box 873,
Boronia VIC 3155 Australia
Tel: 03 9761 3644 Intl: +613 9761 3644 |