How to force JustOn to create new PDF files for multiple invoices?
In certain cases (like layout errors, text typos etc.) you may have to recreate the PDF files for all invoices of a particular invoice run. To this end, you successively execute the following commands in the Execute Anonymous Apex tool of the Developer Console, applying your details (
Find and delete all existing PDF files.
- Up to JustOn 2.48 (PDF in Notes & Attachments):
SELECT Id FROM Attachment WHERE ParentId IN (SELECT Id FROM ONB2__Invoice__c WHERE ONB2__InvoiceRun__c = '<id>') AND ContentType = 'application/pdf' AND Description = 'bill.ON PDF' ORDER BY ParentId ASC NULLS FIRST
- As of JustOn 2.49 (PDF in Files):
SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN (SELECT ID FROM ONB2__INVOICE__c WHERE ONB2__InvoiceRun__c = '<id>')
SELECT Id,ONB2__PDF__c FROM ONB2__Invoice__c WHERE ONB2__InvoiceRun__c = '<id>' AND ONB2__PDF__c != null ORDER BY ONB2__Account__c ASC NULLS FIRST
Download the CSV file, and replace
Update the invoices with the Apex Data Loader.
Use the batch size
100and the serial processing mode.
In the corresponding invoice run detail view, click Set to Open to invoke the PDF regeneration.
If you need to recreate a single invoice PDF, refer to How to force JustOn to create a new PDF for a single invoice?.