You need to sign in to do that
Don't have an account?
Uday K
Removing Duplicate rows Using Apex code or excel
Hi,
I have 4 fields First Name, Last Name, Destination City, Destination State. These 4 columns have some duplicate values. I want to remove those Duplicate rows and these duplicate rows have different "Created Date". have to delete only old dated rows. can someone help me. These records are already in database.
Lead ID | Create Date | First Name | Last Name | Destination City | Destination State |
00QU0000006ideK | 3/23/2008 | dan | ramirez | TX | |
00QU0000006idQI | 3/26/2008 | Erin | Jeffers | Reading | PA |
00QU0000006igC0 | 3/25/2008 | Erin | Jeffers | Reading | PA |
Thanks,
Uday
Hi Uday,
It is possible through batch apex which you can schedule daily or weekly. Which will be your one time solution to remove dupes.
You can follow these steps:
Snippet
for( Lead : SOQL to fetch Leads order by Created Date )
{
IF( setOfStringOfFN_LN_DC_DS.contains( Lead.FN_Lead.LN_Lead.DC_Lead.DS ) )
ListOfLeadIdsToBeDeleted.add(Lead.Id)
ELSE
setOfStringOfFN_LN_DC_DS.add( Lead.FN_Lead.LN_Lead.DC_Lead.DS )
}
delete ListOfLeadIdsToBeDeleted;
It will resolve your problem for sure, Let me know if you have any doubts,
If this post is your solution, kindly mark this as the solution to the post so that others may benefit.
Thanks,
Praful G.
If the above post is your solution, kindly mark this as the solution so that others may benefit.
Regards,
Praful Gadge.