We are novice to SFDC. We have Custom object for Orders. that is Order__c.
We tried following SOQL using Workbench
SELECT colname,count(id) num FROM Order__c group by colname having count(colname ) > 1 limit 200
Output:
We received 200 records duplicate in our custom object.
Aim is : How do i delete duplicates while keeping one record using workbench using soql or Apex.
Case 2: Our problem becomes shifted into Bulk duplicate which is more than 50,000.
We Tried on Structure of Batch Class and want to write logic for duplication over custom object.
Here is sample code :
Want to put above Logic Apex Code into Batch class. So that it will allow Duplicates more than Governor Limits
global class ExampleBatchClass implements Database.Batchable<sObject>{
global ExampleBatchClass(){
// Batch Constructor
}
// Start Method
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
// Execute Logic
global void execute(Database.BatchableContext BC, List<sObject>scope){
// Logic to be Executed batch wise
}
global void finish(Database.BatchableContext BC){
// Logic to be Executed at finish
}
}
Also,We would like to understand Batch Mechanism because Now,we have to deal with more than 50,000 Duplicated records.
Your valuable time is always appreciated on it ?
Thanks in Advance!