You need to sign in to do that
Don't have an account?
SarikaP
I have certain records that gets duplicated. Now if I want to keep one record out of that duplicate group and delete others, what is the best way to do?
Hello,
What my question is as follows?
1 a
2 a
3 a
4 b
5 b
I want to get 1 a and 4 b and delete 2 a, 3 a, 5 b.
Is it possible to do?
What my question is as follows?
1 a
2 a
3 a
4 b
5 b
I want to get 1 a and 4 b and delete 2 a, 3 a, 5 b.
Is it possible to do?
First you need to setup the data duplicate rule in salesforce so that it will not allow you to create any new Duplicate records
Second use some de dupe tools and find the duplciate data and delete it ..
for(Terms_and_Conditions_Quote__c tc : newLst){
quoteidset.add(tc.quote__c);
}
for(AggregateResult r : [Select Count(Id) dupId, quote__c QId ,Terms_and_Conditions__c TNC from Terms_and_Conditions_Quote__c where quote__c in:quoteidset group by quote__c,Terms_and_Conditions__c having Count(Id) > 1]){
System.debug('TNCCount with greater than 1' + (Integer)r.get('dupId'));
if(r != null )
tncdup.put((Id)r.get('Id'),(Id)r.get('TNC')); -----> have the id (to delete record), and the value (that's duplicate)
Basically I retrieved the records that are duplicates but now I am stuck how to keep one and delete other from one group, similarly in others.