Delete Invoices
The deleteInvoices API is used to delete multiple invoices at once by accepting a set of Invoice IDs. This is especially useful for automating invoice cleanup process.
| API | Signature |
|---|---|
| deleteInvoices | static List deleteInvoices(Set invoiceIds) |
- Validates each invoice in the set.
- Deletes invoices that are canceled.
- Return a list of results, one for each invoice, indicating success or failure for each approval attempt.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| invoiceIds | Set | Yes | A set of Invoice record IDs you want to delete. |
Response
| Field | Type | Description |
|---|---|---|
| CustomClass.InvoiceActionResult | List | A result parameter is returned for each request parameter. |
Code Sample - Request
Set<Id> invoiceIds = new Set<Id>{'a5TDc00000161ml','a5TDc00000161mm', 'a5TDc00000161mn', 'a5TDc00000161mo'};
List<Apttus_Billing.CustomClass.InvoiceActionResult> deleteInvoices =
Apttus_Billing.InvoiceService.deleteInvoices(invoiceIds);
System.debug('-deleteInvoices-'+deleteInvoices);Code Sample - Response
deleteInvoices-(InvoiceActionResult:[invoiceId=a5TDc00000161mlMAA, isSuccess=true, message=Invoice has been Deleted.], InvoiceActionResult:[invoiceId=a5TDc00000161mmMAA, isSuccess=true, message=Invoice has been Deleted.], InvoiceActionResult:[invoiceId=a5TDc00000161mnMAA, isSuccess=true, message=Invoice has been Deleted.], InvoiceActionResult:[invoiceId=a5TDc00000161moMAA, isSuccess=true, message=Invoice has been Deleted.])