一括処理クラスの DataBase.emptyRecycleBin メソッドを使って物理削除を実行できます。以下のようにサンプルの一括処理クラスを作成し、一括処理クラスで DataBase.emptyRecycleBin メソッドを使用します。
global class BatchDeletion implements Database.Batchable<sObject>, Schedulable
{
global BatchDeletion()
{
//constuctor
}
global Database.QueryLocator start(Database.BatchableContext bc)
{
// query to delete account records with name 'Test Account12'
return Database.getQueryLocator([Select id from Account where Name='Test Account12']);
}
global void execute(SchedulableContext sc)
{
//execute the batch
BatchDeletion deleteCS = new BatchDeletion();
ID batchprocessid = Database.executeBatch(deleteCS);
}
global void execute(Database.BatchableContext BC, list<sObject> scope)
{
System.debug('## deleting '+scope.size()+' account records');
//delete list of Account records with name Test Account12
delete scope;
Database.emptyRecycleBin(scope);
}
global void finish(Database.BatchableContext BC)
{
//no post processing
}
}
000385786

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.