Happy Business Starts Here

Highlighted
Zuora Alumni
Zuora Alumni

How to mass delete invoices

Question:

How to mass delete invoices?



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Zuora Alumni
Zuora Alumni

Re: How to mass delete invoices

 

Response:

Here are the steps to mass delete invoices through the SOAP API:

1.run a query() against the invoice object to fetch all the Ids of these invoices
2.call an update() that would set the invoice status from "Posted" to "Draft"

<ns1:update>
 <ns1:zObjects xsi:type="ns2:Invoice">
   <ns2:Id>4028e48d35efaa9e0135fed1cd701384</ns2:Id>
   <ns2:Status>Draft</ns2:Status>
  </ns1:zObjects>
</ns1:update>

*the update() call supports a maximum of 50 zObjects at a time on single call

3.call an update() that would set the invoice status from "Draft" to "Canceled"
here's a sample update() call:

<ns1:update>
 <ns1:zObjects xsi:type="ns2:Invoice">
   <ns2:Id>4028e48d35efaa9e0135fed1cd701384</ns2:Id>
   <ns2:Status>Canceled</ns2:Status>
  </ns1:zObjects>
</ns1:update>

*the update()call supports a maximum of 50 zObjects at a time on single call

4.call a delete() that would delete the invoices

<ns1:delete>
 <ns1:type>Invoice</ns1:type>
 <ns1:ids>4028e48d35efaa9e0135fed1cd701384</ns1:ids>
</ns1:delete>

*the delete()call supports a maximum of 50 zObjects at a time on single call

 

 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √