This is my QBXML request
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceModRq requestID="1">
<InvoiceMod>
<TxnID>85-1442639879</TxnID>
<EditSequence>1442639879</EditSequence>
<CustomerRef>
<ListID>80000005-1442639850</ListID>
<FullName>Bruce Banner</FullName>
</CustomerRef>
<TxnDate>2015-09-19</TxnDate>
<RefNumber>5462</RefNumber>
<InvoiceLineMod>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
</InvoiceMod>
</InvoiceModRq>
</QBXMLMsgsRq>
</QBXML>
I am getting an error
QuickBooks found an error when parsing the provided XML text stream.
please help
If you refer to the QuickBooks OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
You'll notice that within the <InvoiceLineMod> element, this node is required:
<TxnLineID>
The OSR gives you a bit more information too:
TxnLineID
Identification number of the transaction line. (TxnLineID
is supported as of v2.0 of the SDK. With qbXML v1.0 and v1.1,
TxnLineID is always returned as zero.)
If you need to add a new transaction line in a transaction Mod
request, you can do so by setting the TxnLineID to -1.
So, you'll need to add in a <TxnLineID> node. If it's a new line item, put -1 for the content within the node. If it's an existing line you're trying to update, put the TxnLineID value of the existing line in there.
Example:
...
<InvoiceLineMod>
<TxnLineID>-1</TxnLineID>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
...
Related
I am using QBFC to add invoices and bills to QB from my C# app. I have it successfully creating invoices, but I am having trouble creating bills.
I have updated this question to remove most of the code. I have been removing pieces of the message to determine the issue and it turns out I am getting the error from the VendorAddress attribute. The attribute comes up in intellisense, but generates the error when sent to QuickBooks. Is there no way to override the vendor address?
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<BillAddRq requestID = "0">
<BillAdd>
<VendorRef>
<FullName>SENECA</FullName>
</VendorRef>
<VendorAddress>
<Addr1>SENECA SAWMILL CO.</Addr1>
<Addr2>UNIT 136</Addr2>
<Addr3>PO BOX 5037</Addr3>
<Addr4/>
<City>PORTLAND</City>
<State>OR</State>
<PostalCode>97208-5037</PostalCode>
<Country>US</Country>
</VendorAddress>
<TxnDate>2018-07-12</TxnDate>
<DueDate>2018-07-22</DueDate>
<RefNumber>12345</RefNumber>
<TermsRef>
<FullName>1.0% 20 DAYS</FullName>
</TermsRef>
<ItemLineAdd>
<ItemRef>
<FullName>1248SK</FullName>
</ItemRef>
<Desc>94080 BF # $410 per MBF
STUD GRADE FIR S4S ALS KD GM 2x4x8</Desc>
<Quantity>17640</Quantity>
<Cost>2.1867</Cost>
<Amount>38572.86</Amount>
</ItemLineAdd>
<ItemLineAdd>
<ItemRef>
<FullName>124PCSK</FullName>
</ItemRef>
<Desc>18816 BF # $400 per MBF
STUD GRADE FIR S4S ALS KD GM 2x4x7' 8 5/8</Desc>
<Quantity>3528</Quantity>
<Cost>2.1333</Cost>
<Amount>7526.39</Amount>
</ItemLineAdd>
</BillAdd>
</BillAddRq>
</QBXMLMsgsRq>
</QBXML>
The QuickBooks desktop API is versioned, and the versioning is controlled by this line in your example:
<?qbxml version="6.0"?>
You're using version 6.0 of qbXML, and if you refer to the QuickBooks OSR:
https://static.developer.intuit.com/qbSDK-current/common/newosr/index.html
You'll see that the VendorAddress component isn't supported until 13.0:
You need to either not include this tag, or change the qbXML version you're using (or potentially do both, if you want to cater to QuickBooks versions that support this qbXML version AND QuickBooks versions that do not support this qbXML version).
try changing the version number and try again. Let's see if your Quickbook APP desktop version is compatible to it or not.
Example :
<?qbxml version="13.0"?>
If you're using QBFC, then you can specify the version when creating the message set request
IMsgSetRequest rqMsgSet = qbSsnMgr.CreateMsgSetRequest("US", 13, 0);
So my problem is pretty simple: I am trying to add a customer to Quickbooks using ASP.NET and QBWebConnector, and thankfully I am succeeding. The problem occurs when I try to add custom fields to the customer.
Here's the qbposxml I am sending:
<?xml version="1.0" encoding="UTF-8"?>
<?qbposxml version="3.0"?>
<QBPOSXML>
<QBPOSXMLMsgsRq onError="stopOnError">
<CustomerAddRq requestID="1">
<CustomerAdd>
<Salutation>Mr.</Salutation>
<FirstName>Ammar</FirstName>
<LastName>Ahmed</LastName>
<BillAddress>
<Street>asascc, asdas</Street>
</BillAddress>
<Phone>03321221221</Phone>
</CustomerAdd>
</CustomerAddRq>
<DataExtModRq>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>IDNumber</DataExtName>
<ListDataExtType>Customer</ListDataExtType>
<ListObjRef>
<FullName>Ammar Ahmed</FullName>
</ListObjRef>
<DataExtValue>12331</DataExtValue>
</DataExtMod>
</DataExtModRq>
<DataExtModRq>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>GebDatum</DataExtName>
<ListDataExtType>Customer</ListDataExtType>
<ListObjRef>
<FullName>Ammar Ahmed</FullName>
</ListObjRef>
<DataExtValue>21/22/12</DataExtValue>
</DataExtMod>
</DataExtModRq>
</QBPOSXMLMsgsRq>
</QBPOSXML>
Now the response I get is this:
<?xml version="1.0" encoding="UTF-8"?>
<QBPOSXML>
<QBPOSXMLMsgsRs>
<CustomerAddRs requestID="1" statusCode="0" statusMessage="Status OK" statusSeverity="Info">
<CustomerRet>
<ListID>755269278256496897</ListID>
<TimeModified>2017-03-08T14:00:42+05:00</TimeModified>
<AccountBalance>0.00</AccountBalance>
<AccountLimit>0.00</AccountLimit>
<CustomerDiscPercent>0.00</CustomerDiscPercent>
<CustomerDiscType>None</CustomerDiscType>
<FirstName>Ammar</FirstName>
<FullName>Mr. Ammar Ahmed</FullName>
<IsAcceptingChecks>True</IsAcceptingChecks>
<IsUsingWithQB>False</IsUsingWithQB>
<LastName>Ahmed</LastName>
<Phone>03321221221</Phone>
<PriceLevelNumber>1</PriceLevelNumber>
<Salutation>Mr.</Salutation>
<StoreExchangeStatus>Modified</StoreExchangeStatus>
<BillAddress>
<Street>asascc, asdas</Street>
</BillAddress>
</CustomerRet>
</CustomerAddRs>
<DataExtModRs statusCode="20036" statusMessage="Extension error (ListID is missing)" statusSeverity="Error">
<DataExtRet />
</DataExtModRs>
</QBPOSXMLMsgsRs>
</QBPOSXML>
I don't know how to get the ListID of the customer I am adding since it is created after the customer is added.
Thing to note: Customer is added but without custom fields. From this and this I gathered that I didn't need ListID.
Any help would be highly appreciated.
Update:
So after the answer by William Lorfing, I checked out Chapter 6 of QBPOS Programmer's Guide and discovered macros. Here's how I ended up using them, with outstanding results:
My CustomerAdd Request became:
<?xml version="1.0" encoding="UTF-8"?>
<?qbposxml version="3.0"?>
<QBPOSXML>
<QBPOSXMLMsgsRq onError="stopOnError">
<CustomerAddRq requestID="1">
<CustomerAdd defMacro="ListID:Cust1"> NOTICE THE INITIALIZATION OF MACRO!
<Salutation>Mr.</Salutation>
<FirstName>Ammar</FirstName>
<LastName>Ahmed</LastName>
<BillAddress>
<Street>asascc, asdas</Street>
</BillAddress>
<Phone>03321221221</Phone>
</CustomerAdd>
</CustomerAddRq>
<DataExtModRq>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>IDNumber</DataExtName>
<ListDataExtType>Customer</ListDataExtType>
<ListObjRef>
<ListID useMacro="ListID:Cust1" /> NOTICE THE USE OF MACRO!
</ListObjRef>
<DataExtValue>12331</DataExtValue>
</DataExtMod>
</DataExtModRq>
<DataExtModRq>
<DataExtMod>
<OwnerID>0</OwnerID>
<DataExtName>GebDatum</DataExtName>
<ListDataExtType>Customer</ListDataExtType>
<ListObjRef>
<ListID useMacro="ListID:Cust1" /> NOTICE THE USE OF MACRO!
</ListObjRef>
<DataExtValue>21/22/12</DataExtValue>
</DataExtMod>
</DataExtModRq>
</QBPOSXMLMsgsRq>
</QBPOSXML>
First we initialize the macro and then we use it, thus avoiding additional request and don't know how many lines of useless code just to add custom fields.
Thanks William Lorfing for the hint in the right direction.
For QBPOS SDK, ListObjRef required ListID and not fullname.
You will either have to do the customeradd and then in the next request do the DataExtAdd with the ListID or you can try using Macros. See Chapter 6 of the POS SDK Programmers Guide.
The guide is included in the POS SDK.
Please help:
I did add and edit functionality in QuickBooks through QuickBooks SDK using my windows application (C#).
Now, I want to know, how to do delete operation in QuickBooks using QuickBooks SDK?
This is my XML Request:
<?xml version="1.0"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<EmployeeModRq requestID="1">
<EmployeeMod>
<ListID>800002A0-1477976825</ListID>
<EditSequence>1477977063</EditSequence>
<IsActive>False</IsActive>
<FirstName>Bobby</FirstName>
<MiddleName></MiddleName>
<LastName>Westbrooks(111-11-1111)</LastName>
<EmployeeAddress>
<Addr1>4205 Coleman</Addr1>
<City>Memphis</City>
<PostalCode>38128</PostalCode>
</EmployeeAddress>
<SSN>111-11-1111</SSN>
<Email>bgwestbrooks#brmch.com</Email>
<EmergencyContacts>
<PrimaryContact>
<ContactName>Rhonda Westbrooks</ContactName>
<ContactValue>0</ContactValue>
</PrimaryContact>
</EmergencyContacts>
<HiredDate>2015-11-11</HiredDate>
<ReleasedDate>2015-11-11</ReleasedDate>
<BirthDate>2015-11-11</BirthDate>
</EmployeeMod>
</EmployeeModRq>
</QBXMLMsgsRq>
</QBXML>
</xml>
You can use the ListDel request to delete employees (and other List type objects like customers, vendors, etc).
From the OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
ListDel - Delete a list object
ou can only delete a list item from a QuickBooks company file if the
file is open in single-user mode. If the file is open in multiuser
mode, your application will receive an error. (This restriction does
not apply to deleting or voiding transaction objects.)
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ListDelRq>
<!-- ListDelType may have one of the following values: Account, BillingRate, Class, Currency, Customer, CustomerMsg, CustomerType, DateDrivenTerms, Employee, InventorySite, ItemDiscount, ItemFixedAsset, ItemGroup, ItemInventory, ItemInventoryAssembly, ItemNonInventory, ItemOtherCharge, ItemPayment, ItemSalesTax, ItemSalesTaxGroup, ItemService, ItemSubtotal, JobType, OtherName, PaymentMethod, PayrollItemNonWage, PayrollItemWage, PriceLevel, SalesRep, SalesTaxCode, ShipMethod, StandardTerms, ToDo, UnitOfMeasureSet, Vehicle, Vendor, VendorType, WorkersCompCode -->
<ListDelType >ENUMTYPE</ListDelType> <!-- required -->
<ListID >IDTYPE</ListID> <!-- required -->
</ListDelRq>
</QBXMLMsgsRq>
</QBXML>
Below is my result from web service, how can I change the record name so that it's uniquely identified? e.g. Record1, Record2, Record3.
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ArrayOfRecord xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Record> /*How to change this Record to Record1*/
<item>
Buffalo DriveStation Combo 3.5 inch External Hard Drive USB 2.0 1.5TB Quadra
</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription>-</itemdescription>
<id>188</id>
</Record>
<Record>
<item>eSataII HDD Docking with 1TB 3.5 inch hard disk</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription/>
<id>184</id>
</Record>
</ArrayOfRecord>
Instead of changing the record name include a unique column in the resultset being returned by the web service, you can use a sequence number if you do not have any unique column.
For example you can add itemId a new column in Record
<Record> /*How to change this Record to Record1*/
<itemId>1</itemId>
<item>
Buffalo DriveStation Combo 3.5 inch External Hard Drive USB 2.0 1.5TB Quadra
</item>
<qty>1</qty>
<qtyapproved>1</qtyapproved>
<availability>0</availability>
<description>Returned</description>
<itemdescription>-</itemdescription>
<id>188</id>
</Record>
There is an invalid reference to QuickBooks Customer "ABS, JLMN" in the Invoice. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
<InvoiceAddRq requestID = "***">
<InvoiceAdd>
<CustomerRef>
<FullName>ABS, JLMN</FullName>
</CustomerRef>
<TxnDate>2014-10-31</TxnDate>
<TermsRef>
<FullName>*Proper existing term*</FullName>
</TermsRef>
<DueDate>2014-11-30</DueDate>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*String Value*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
<InvoiceLineAdd>
<ItemRef>
<FullName>*Proper existing term*</FullName>
</ItemRef>
<Desc>*Strings of text*</Desc>
<Rate>0.00</Rate>
</InvoiceLineAdd>
</InvoiceAdd>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>CustomerRef</IncludeRetElement>
<IncludeRetElement>ItemRef</IncludeRetElement>
</InvoiceAddRq>
Please note that the values mentioned in "*"s are only place holders.
The customer ABS, JLMN is present in Quick books but still I get this error. This is not the only request while generating the request XML, there are other customers also with same properties. I am not getting any error for those customers. Can any one please let me know what can be the problem here?
Is there any chance that my company file is corrupted? I am doing many InvoiceADD and CustomerADD requests with the company file as a part of my requirements. So could that be a reason for the problem here?
Please let me know if you need any more information.
Thanks.
There is an invalid reference to **QuickBooks** Customer "ABS, JLMN" in the Invoice.
This error Occurs when Customer "ABS, JLMN" does not exists in the Quickbooks and you try to add invoice against that customer.
If customer already exists in Quickbooks then parse the name of customer in your requestXML. Special characters also create errors.