Batch job - delete Account Based Document categories not meeting configured criteria
With the introduction of the new org setting Account Based Document Generation, users can now set up document definitions with specific account types. Initially, all document definitions set up for accounts were created for every account. To restrict the creation of document categories for specific accounts, the concept of account types was introduced. Once the setup of document definitions based on account types is complete, users can run a job to clear out existing data according to the setup. This process can reduce the number of existing document categories in the org and help free up space.
With the April 2024 release, users can now execute the AccountDocumentCategoryClearJob to delete all existing document categories that do not meet the criteria configured on the document definition. The document definition serves as the configuration object that, when executed, generates document categories on the Account.
Prerequisites
You must enable the Account Based Documents Generation in the custom settings.
To enable the Account Based Documents Generation checkbox, follow the steps:
Log in to your Salesforce account.
Go to (Setup) > Setup.
In the Quick Find box, search for Custom Settings, and select it.
Select Manage of Org Parameters (genesis).
Select Edit and enable the Account Based Documents Generation checkbox.
Select Save.
Steps
To execute AccountDocumentCategoryClearJob:
Log in to your Salesforce account.
Go to Developer Console > Debug > Open Execute Anonymous window.
Run the following script:
Scriptgenesis.AccountDocumentCategoryClearJob job = new genesis. AccountDocumentCategoryClearJob();
Database.execute(job);