Approve Invoices
The approveInvoices API is used to approve multiple invoices at once by accepting a set of Invoice IDs. This is especially useful for bulk operations, such as approving all invoices after an invoice run.
| API | Signature |
|---|---|
| approveInvoices | static List approveInvoices(Set invoiceIds) |
- Validates each invoice in the set.
- Approves invoices that are eligible (e.g., in Draft or Pending Approved status).
- The status of the associated billing schedules is changed to Invoiced.
- The Remaining Billable Amount field is reduced by the fee amount of the schedule that was just invoiced.
- The usage quantity and the corresponding fee amount are locked for that billing period.
- 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 approve. |
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>{'a5TDc00000161lM','a5TDc00000161lN', 'a5TDc00000161lO', 'a5TDc00000161lP', 'a5TDc00000161lQ', 'a5TDc00000161lR', 'a5TDc00000161lG'};
List<Apttus_Billing.CustomClass.InvoiceActionResult> approveInvoices =
Apttus_Billing.InvoiceService.approveInvoices(invoiceIds);
System.debug('-approveInvoices-'+approveInvoices);Code Sample - Response
approveInvoices-(InvoiceActionResult:[invoiceId=a5TDc00000161mlMAA, isSuccess=true, message=Invoice has been Approved.], InvoiceActionResult:[invoiceId=a5TDc00000161mmMAA, isSuccess=true, message=Invoice has been Approved.])