Search code examples
quickbooksqbfc

Deleting Invoice and Bill


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.


Solution

  • 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);