Using QB SDK 12.0
I have a scenario where I create a new Employee and then a Sales Rep using the Employee ListID.
If I try to enter a Sales Rep that duplicates and existing Initial, the Sales Rep fails and then I want to delete the Employee.
I don't see how I can delete the Employee, or any List item (Customer, Vendor, etc) for that matter. Is it possible, or do I have to mark them IsActive = False?
Rick
You can use ListDel to delete list objects (customers, vendors, employees, items, etc.).
The qbXML syntax is:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="12.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>
More qbXML examples:
QuickBooks qbXML example - deleting list objects
QuickBooks qbXML examples
Related
I'm running this query:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="14.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceQueryRq>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>1</IncludeLinkedTxns>
</InvoiceQueryRq>
</QBXMLMsgsRq>
</QBXML>
And I get this invoice line which is an expense created with the "Add Time/Costs" button in Quickbooks Desktop.
<InvoiceLineRet>
<TxnLineID>8E-1343336207</TxnLineID>
<Desc>License and Title</Desc>
<Rate>315</Rate>
<Amount>315.00</Amount>
<ServiceDate>2012-07-26</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1343060273</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
With most invoice lines, there's an item associated with it and I can get the account(s) associated with the item. I want to get the account ListID that's associated with this invoice line, as with other invoice lines. I can get the account name with a GeneralDetailReportQuery, but not the ID, and that report is much harder to work with as I'm importing Quickbooks data into another system.
How can I find the accountID for lines like this?
I have a customer in Quickbook Desktop, so that I have generated a slaes order for the particular customer, now for the customer sales order I have to generate a invoice. . When I tried it I got the following error. How to link a quickbook desktop customer sales order to a invoice?
I tried using IDTYPE attribute. What is wrong here? Kindly help
0x80040400: QuickBooks found an error when parsing the provided XML text stream.
Parsing response.
Processing response.
Job 'create_invoice' received response: ''.
This is my sales order xml response.
{"xml_attributes"=>{},
"txn_id"=>"75-1640702627",
"time_created"=>"2021-12-28T14:43:47+00:00",
"time_modified"=>"2021-12-28T14:43:47+00:00",
"edit_sequence"=>"1640702627",
"txn_number"=>37,
"customer_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000001-1640593593", "full_name"=>"Test Customer"},
"template_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000008-1640593060", "full_name"=>"Custom Sales Order"},
"txn_date"=>"2021-12-28",
"ref_number"=>"18",
"bill_address"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"bill_address_block"=>{"xml_attributes"=>{}, "addr1"=>"212 W. Chskskss St.", "addr2"=>"Ste.100", "addr3"=>"wqw, Parròquia d'Encamp www", "addr4"=>"Andorra"},
"due_date"=>"2021-12-28",
"ship_date"=>"2021-12-28",
"subtotal"=>1.0,
"sales_tax_percentage"=>0.0,
"sales_tax_total"=>0.0,
"total_amount"=>1.0,
"is_manually_closed"=>false,
"is_fully_invoiced"=>false,
"is_to_be_printed"=>true,
"is_to_be_emailed"=>false}
Trying to generate invoice for this particular sales order
Here is my invoice XML attributes that I am sending to Quickbook Desktop
xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq >
<InvoiceAdd>
<CustomerRef>
<FullName>Test Customer</FullName >
</CustomerRef>
<BillAddress>
<Addr1>212 W. Chskskss St.</Addr1>
<Addr2>Ste.100</Addr2>
<City>wqw</City>
<State>Parròquia d'Encamp www</State>
<PostalCode>06268</PostalCode>
<Country>Andorra</Country>
</BillAddress>
<InvoiceLineAdd>
<ItemRef>
<FullName >Inspection Request</FullName>
</ItemRef>
<Desc >plants</Desc>
<Quantity >1</Quantity>
<Amount >50.00</Amount>
</InvoiceLineAdd>
<LinkToTxnID>75-1640702627<LinkToTxnID>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>'
First thing coming to my mind is: "Where is your closing QBXML tag?"
</QBXML>
Beside that. The SDK includes an XML Validator tool which you can use to validate the XML structure. Try to use this to see where your structure probably does not meet the requirements.
I want to delete a particular customer from quickbooks using the ListId of that customer . What would be my qbxml request in that case ?
You can use the ListDelRq to delete list-type things (Customers, Items, Vendors, etc.) from QuickBooks.
Refer to the OSR for full syntax:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Your request will look something like this:
?xml version="1.0" encoding="utf-8"?>
<?qbxml version="9.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>
<ListID>IDTYPE</ListID>
</ListDelRq>
</QBXMLMsgsRq>
</QBXML>
We have QuickBooks Canada version. When we fetch records for Purchase Order it does returns all the records and along with that returns Tax row which is being added by QuickBooks CA.
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<PurchaseOrderQueryRq requestID="1">
<TxnID>2304-1229340744</TxnID>
<IncludeLineItems>1</IncludeLineItems>
<IncludeLinkedTxns>0</IncludeLinkedTxns>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>EditSequence</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineGroupRet</IncludeRetElement>
<IncludeRetElement>PurchaseOrderLineRet</IncludeRetElement>
<OwnerID>0</OwnerID>
</PurchaseOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>
The extra row response has is
<PurchaseOrderLineRet>
<TxnLineID>2311-1229340744</TxnLineID>
<ItemRef>
<ListID>490000-1195038595</ListID>
<FullName>Summary GST for purchases</FullName>
</ItemRef>
<Desc>Total GST</Desc>
<Rate>5.0%</Rate>
<ClassRef>
<ListID>40001-1199213409</ListID>
<FullName>Pro Shop:Special orders</FullName>
</ClassRef>
<Amount>798.00</Amount>
<CustomerRef>
<ListID>10000-1193777303</ListID>
<FullName>Receiver General</FullName>
</CustomerRef>
<ReceivedQuantity>0</ReceivedQuantity>
<IsBilled>false</IsBilled>
<IsManuallyClosed>false</IsManuallyClosed>
</PurchaseOrderLineRet>
Is there a way to identify this row.
Issue is, if we want to update this order we need to send all the Order line.
And if we send the last line which is of Tax (generated by QB) , QuickBooks SDK throws error.
MLMsgsRs>
<PurchaseOrderModRs requestID="1" statusCode="3120" statusSeverity="Error" statusMessage="Object "2311-1229340744" specified in the request cannot be found. " />
So we need to exclude this line on the PurchaseOrderModRq
Note : Not all Purchase Order's Last line has this tax row.
Export the tax items and compare the Item Refs in the exported PO data against the list of tax items.
I'm having an issue trying to get tax applied to an invoice with QBXML. I'm using SalesTaxCodeRef in InvoiceLineAdd but it doesn't seem that it's working for whatever reason. This same code worked for SalesReceiptAddRq. Am I missing a flag or something?
<?xml version="1.0" encoding="UTF-8"?>
<?qbxml version="11.0"?><QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="c16d1753af62163f3891551c07a1eed493bb291a">
<InvoiceAdd>
<CustomerRef>
<FullName>Customers FullName</FullName>
</CustomerRef>
<TemplateRef>
<FullName>Default Template</FullName>
</TemplateRef>
<TxnDate>2013-07-31</TxnDate>
<RefNumber>12324</RefNumber>
<BillAddress>
<Addr1>Customers FullName</Addr1>
<Addr2>123 Test Dr</Addr2>
<Addr3></Addr3>
<City>Customer City</City>
<State>AL</State>
<PostalCode>12323</PostalCode>
<Country>US</Country>
</BillAddress>
<ShipAddress>
<Addr1>Customers FullName</Addr1>
<Addr2>123 Test Dr</Addr2>
<Addr3></Addr3>
<City>Customer City</City>
<State>AL</State>
<PostalCode>12323</PostalCode>
<Country>US</Country>
</ShipAddress>
<IsPending>false</IsPending>
<IsToBePrinted>false</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<InvoiceLineAdd>
<ItemRef>
<ListID>80000540-1339572998</ListID>
</ItemRef>
<Desc>Item Desc</Desc>
<Quantity>1</Quantity>
<Rate>39.27</Rate>
<SalesTaxCodeRef>
<FullName>SBT</FullName>
</SalesTaxCodeRef>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
For non-USA versions of QuickBooks (CA, UK, etc.):
What you have should work, ASSUMING that the Sales Tax Code "SBT" is correctly mapped to a tax rate in your tax preferences within QuickBooks.
For USA versions of QuickBooks:
Sales tax codes just indicate whether something is TAXable, or NONtaxable. They do NOT actually indicate any tax amount, or force tax to be recorded/charged.
In addition to the Sales tax code, you also need to specify an ItemSalesTaxRef, which is a reference to a specific tax item (a specific tax rate, e.g. 7%).
...
<ItemSalesTaxRef>
<FullName>My Existing Tax Item Name</FullName>
</ItemSalesTaxRef>
<IsToBePrinted>true</IsToBePrinted>
...
CHeck your XML with the SDK Validator.