Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Cancel Invoices

cancelInvoices API is used to to cancel a set of invoices. It accepts a set of invoice IDs, validates each invoice in the set, cancels the eligible invoices, and returns a list of results (InvoiceActionResult), which includes details for each invoice.

APISignature
cancelInvoicesstatic List cancelInvoices(Set invoiceIds, Boolean updateSourceInvStatus, Boolean isSplitInvoice)
When you call the API and input a set of invoice IDs and two boolean flags, the API:
  • Validates the invoices and cancels the eligible invoices.
  • After cancellation, all billing schedules and usage schedules are set to Pending Billing.
  • Only Invoice(s) with a status of Draft, Draft Obsolete, Pending Approved or Approved can be Canceled.

Request Parameters

FieldTypeRequiredDescription
invoiceIdsSetYesA set of Invoice record IDs you want to cancel.
updateSourceInvStatusBooleanYesThis flag determines whether the source invoice status should be updated as part of the cancellation process. For example, if set to true, the API will update the status of the original invoice record (e.g., from Approved to Cancelled). If false, it may skip this update.
isSplitInvoiceBooleanYesFlag to determine if the invoice is a split invoice.

Response

FieldTypeDescription
CustomClass.InvoiceActionResultListA result parameter is returned for each request parameter.

Code Sample - Request


Set<Id> invoiceIds = new Set<Id>{'a5TDc00000161lM','a5TDc00000161lN', 'a5TDc00000161lO', 'a5TDc00000161lP', 'a5TDc00000161lQ', 'a5TDc00000161lR', 'a5TDc00000161lG'};
List<Apttus_Billing.CustomClass.InvoiceActionResult> cancelInvoices = 
Apttus_Billing.InvoiceService.cancelInvoices(invoiceIds, true, true);
System.debug('-cancelInvoices-'+cancelInvoices);

Code Sample - Response

cancelInvoices-(InvoiceActionResult:[invoiceId=a5TDc00000161mlMAA, isSuccess=true, message=Invoice has been Cancelled.], InvoiceActionResult:[invoiceId=a5TDc00000161mmMAA, isSuccess=true, message=Invoice has been Cancelled.], InvoiceActionResult:[invoiceId=a5TDc00000161mnMAA, isSuccess=true, message=Invoice has been Cancelled.], InvoiceActionResult:[invoiceId=a5TDc00000161moMAA, isSuccess=true, message=Invoice has been Cancelled.])