You need to sign in to do that
Don't have an account?
Szymon
Insert records into custom object using an Apex class
Hi, wonder if anyone could guide me in the right direction. Got the below class but the requirement has changed since and now I need to insert the id's of deleted records into a custom object for tracking purposes before they get deleted. any ideas? Thanks
global class BatchDeletion implements Database.Batchable<sObject>, Schedulable{ global BatchDeletion(){} global Database.QueryLocator start(Database.BatchableContext bc){ return Database.getQueryLocator([Select id from Case where Archived__c='true']); } //Execute method for the Schedulable interface global void execute(SchedulableContext sc){ //execute the batch BatchDeletion deleteCS = new BatchDeletion(); ID batchprocessid = Database.executeBatch(deleteCS); } //Execute method for the batchable interface global void execute(Database.BatchableContext BC, list<sObject> scope){ delete scope; DataBase.emptyRecycleBin(scope); } global void finish(Database.BatchableContext BC){} }
Assumption : Custom Object API = CustomObject__c and field to store the case id is DeletedCaseId__c
All Answers
Assumption : Custom Object API = CustomObject__c and field to store the case id is DeletedCaseId__c