Generate Invoice Lines Summary
generateInvoiceLinesSummary API is used to generate a summary of invoice line items for a set of invoices.
| API | Signature |
|---|---|
| generateInvoiceLinesSummary | static (Set<Id> invoiceIds, String invoiceSummaryCriteria, Boolean isAsyncMode) |
The summary groups invoice lines based on the specified criterion (like Charge Type, Start Date, Ship To, etc.) and calculates totals for each group, such as Fee Amount, Tax Amount, and Sub Total. The result is a map containing the summary data, which is then displayed in the Invoice Lines Summary related list on the invoice record.
- Creates a summary for invoice line items in draft or approved status.
- Provides the ability to view the summary on the invoice records.
- Displays the summary of invoice lines like a snapshot, allowing the user to merge this summary into the invoice document.
- Allows the user to select a different summary criterion to re-create, merge, and send a new invoice summary based on customer requests.
Request
| Field | Type | Required? | Description |
|---|---|---|---|
| invoiceIds | Set | Yes | A set of Invoice record IDs for which you want to generate the summary lines. |
| invoiceSummaryCriteria | String | Yes | The API name of the field to use as the summary criterion (e.g., Charge Type, Start Date, Price Type, Ship To, Location, or a custom field). |
| isAsyncMode | Boolean | No | If true, the summary generation runs in batch (asynchronous) mode. |
Response
| Field | Type | Description |
|---|---|---|
| mapinvoiceSummaryCriteria | Map | map containing the result of each processed invoice |
Code sample
Set<Id> invoiceIds = new Set<Id>{'a5TDc00000161lG', 'a5TDc00000161lB'};
Map<String, Object> result = Apttus_Billing.InvoiceService.generateInvoiceLinesSummary(
invoiceIds, // Set of Invoice Ids
'AssetLineItemId__r.Apttus_Config2__ChargeType__c', // Criteria Name
true); // Boolean flag - If yes then batch mode will be executed otherwise sync mode will run
System.debug('================'+result);