You are here:
Document Generation Process Cleaner Utility
The Document Generation Process Cleaner Utility permanently deletes records within a specified time frame to create space for content document generation in Salesforce. You can use the utility to delete the document generation process records and their associated token data content documents or only the token data content documents. The utility can clean up 100,000 records and their respective token data files of 1MB size in about 2 hours.
During server-side document generation, the TokenDataContentDocumentId field in the Document Generation Process entity is used for passing token data that’s more than 131k characters. The TokenDataContentDocumentId field references ContentDocument records that hold the JSON token data as .txt or .json files.
The utility calls cleanDocumentGenerationProcessAndContentDocument and cleanContentDocument Apex class methods.
Deleting content documents that are part of an in-progress document generation request can cause the document generation request to fail.
It might not be possible to retrieve the deleted data from the recycle bin by the calling Apex class methods cleanDocumentGenerationProcessAndContentDocument and cleanContentDocument.
- Apex Classes for Document Generation Process Cleaner Utility
Use the DocumentGenerationProcessCleanerUtility and BatchDeleteHelper Apex classes to create storage space for content document generation in Salesforce. Create these Apex classes using the sample code we've provided. If required, you can modify the statusList and batchSize fields. - Run the Document Generation Process Cleaner Utility in Developer Console
Use the Document Generation Process Cleaner Utility to either delete the document generation process records and their associated token data content documents or only the token data content documents.

