Troubleshooting - [QODBC] Error 3000 - The given object ID "" in the field "list id" is invalid
Problem Description:
I get a very generic error when I try and use QODBC to create an invoice.
I am using below query:
INSERT INTO InvoiceLine ("TemplateRefListID", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineAmount", "InvoiceLineQuantity", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('80000011-1203804797','80002C72-1345040417','My item 1',19.95, 1, '', 1)
INSERT INTO InvoiceLine ("TemplateRefListID", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineAmount", "InvoiceLineQuantity", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('80000011-1203804797','80003194-1404606055','My item 2',22.50, 1, '', 1)
INSERT INTO Invoice ("TemplateRefListID", "CustomerRefListID","CustomerRefFullName", "BillAddressAddr1", "BillAddressAddr2","BillAddressCity", "BillAddressState", "BillAddressPostalCode", "ShipAddressAddr1", "ShipAddressAddr2", "ShipAddressCity", "ShipAddressState", "ShipAddressPostalCode", "SalesRepRefFullName", "ShipMethodRefListID") VALUES ('80000011-1203804797', '80000440-1448981709','FAKEEBAY','Someone', 'Address 1 ', 'The city', 'State', 'Zip', 'Someone', 'Address 1', 'City', 'State', 'Zip', 'Rep', '80000004-1202486852')
The error is:
[QODBC] Error: 3000 - The given object ID "" in the field "list id" is invalid.
Solution:
You are tring to insert blank value for the field "InvoiceLineSalesTaxCodeRefListID".
To resolve this issue, either you need to insert a valid value for InvoiceLineSalesTaxCodeRefListID field OR you have to remove InvoiceLineSalesTaxCodeRefListID field from your insert statement.
Remove the LISTID field from the query. Example:
INSERT INTO InvoiceLine ("TemplateRefListID", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineAmount", "InvoiceLineQuantity", "FQSaveToCache") VALUES ('80000011-1203804797','80002C72-1345040417','My item 1',19.95, 1, 1)
Specify value for LISTID field Example:
INSERT INTO InvoiceLine ("TemplateRefListID", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineAmount", "InvoiceLineQuantity", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('80000011-1203804797','80002C72-1345040417','My item 1',19.95, 1, '90000011-1234567800', 1)
So please insert valid value in InvoiceLineSalesTaxCodeRefListID field or remove InvoiceLineSalesTaxCodeRefListID field from your insert query.