How to create a new transaction table?
When billing usage data, you can configure JustOn to attach transaction tables to the invoice, either
- including a transaction table in the invoice PDF, or
- attaching a transaction CSV file to the invoice.
In certain cases (like layout errors, text typos etc.) you may have to regenerate the transaction table for open invoices. Depending on whether you print the table to the PDF or attach a CSV to the invoice, the steps to do so differ.
Recreating Invoice Transaction Table
Note
Make sure that the checkbox field ON_AddToTransactionTable
on the source object is selected.
- Open the invoice for which you want to create a new transaction table.
-
In the Notes & Attachments section, delete the attached transaction table.
This is not necessary with draft invoices.
-
Open an appropriate invoice list view.
- In the invoice list, select the checkbox next to the invoice for which you want to create a new transaction table.
- On top of the invoice list, click to open the list view actions, then select Rebuild Transaction Tables.
- Open the invoice for which you want to create a new transaction table.
-
Click Recreate PDF, then click Continue to confirm and complete the operation.
This creates a new version of the PDF file, which includes the new transaction table.
This is not necessary with draft invoices.
Recreating Transaction CSV Attachment
Note
Make sure that the checkbox field ON_AddToCsv
on the source object is selected.
- Open the invoice for which you want to create a new transaction CSV file.
- In the Notes & Attachments section, delete the attached transaction CSV.
- Open an appropriate invoice list view.
- In the invoice list, select the checkbox next to the invoice for which you want to create a new transaction CSV file.
-
Click to open the action menu, then select Finalize.
This repeats the batch finalization for the selected invoice, which involves creating a new transaction CSV file.
Recreating transaction CSV using Apex
Instead of rerunning the invoice finalization, you can use Apex to recreate transaction CSV files. In the Execute Anonymous Apex tool of the Developer Console, execute the following code, applying your details:
Set<Id> invoiceIds = new Map<Id, sObject>([SELECT Id FROM ONB2__Invoice__c WHERE <invoice condition>]).keySet();
new ONB2.ChainRunner().execute(
new ONB2.ChainFactory().getForBatchNames(new List<String>{'TransactionCsvBatchRenderHelper'})
.setParameters(
new Map<String, Object>{'invoiceIds' => invoiceIds}
)
);
This creates new transaction CSV files for the selected invoices.