2

I could not figure out how to delete an Invoice or Bill using qbfc (using version 13). there is a method to delete a list item but could not find a similar transaction delete method.

hazimdikenli
  • 5,709
  • 8
  • 37
  • 67
  • FYI accountants get nervous when people delete transactions rather than voiding them. Make sure this is what your users really want. – MikeBr59 Sep 12 '14 at 16:27
  • I am integrating invoices and bills from another system, and when they delete it from the original system it has to be deled from QB.I am trying to give them a control screen where they can check and delete the transactions just by clicking a few buttons. – hazimdikenli Sep 12 '14 at 17:13
  • I am hoping that the system would throw an error if that invoice/bill was paid. – hazimdikenli Sep 12 '14 at 17:19

1 Answers1

7

Use a TxnDel request.

XML example:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="11.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <TxnDelRq>
      <!-- TxnDelType may have one of the following values: ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, PayrollLiabilityAdjustment [PRIVATE], PayrollPriorPayment [PRIVATE], PayrollYearToDateAdjustment [PRIVATE], PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, TimeTracking, TransferInventory, VehicleMileage, VendorCredit -->
      <TxnDelType>Invoice</TxnDelType> <!-- required -->
      <TxnID>ABCD-1234</TxnID> <!-- required -->
    </TxnDelRq>
  </QBXMLMsgsRq>
</QBXML>

Should look something like:

ITxnDel TxnDelRq= requestMsgSet.AppendTxnDelRq();

//Set field value for TxnDelType
TxnDelRq.TxnDelType.SetValue(ENTxnDelType.tdtARRefundCreditCard);

//Set field value for TxnID
TxnDelRq.TxnID.SetValue("200000-1011023419");

IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
Keith Palmer Jr.
  • 27,666
  • 16
  • 68
  • 105
  • I tought the transaction ID would be the same transaction ID that we recieve from the add message. Looks like it is not. What should we pass as the transaction Id? – hazimdikenli Sep 12 '14 at 14:43
  • It is. What makes you think it isn't? – Keith Palmer Jr. Sep 12 '14 at 14:46
  • Because I get a status code of 3000 saying that the transaction does not exists. (I am passing in the returned txn number not the invoice number) The message is: The given object ID "37592" in the field "Transaction id" is invalid. – hazimdikenli Sep 12 '14 at 16:48
  • 1
    You're passing in a TxnNumber, when you should be passing in a TxnID value. Hence the call to .TxnID.SetValue(...) and the error message indicating the error is with the "Transaction id" field. TxnNumber != TxnID – Keith Palmer Jr. Sep 12 '14 at 17:12
  • Yup I see it, I am storing and passing back the TxnNumber, not the TxnID. I have to change that part of integration log and start storing the TxnId for that to work. Thanks a lot Keith. – hazimdikenli Sep 12 '14 at 17:17