You need to sign in to do that
Don't have an account?
Priyanka Dumka
apex for below scenario : We have received list of duplicates and from that list we want to remove the duplicate on basis of name, email and phone number ?
apex for below scenario :
We have received list of duplicates and from that list we want to remove the duplicate on basis of name,email and phone number ?
We have received list of duplicates and from that list we want to remove the duplicate on basis of name,email and phone number ?
Why don't you try duplicate rules and restrict duplicate records from the very first door? Checkout duplicate rule article here: https://help.salesforce.com/s/articleView?id=sf.duplicate_rules_map_of_reference.htm&type=5
Best Regards
Gulshan Raj
As per your ask , you want to prevent duplicates records based on multiple fields , so for this I would request you to go through this reference article once for your understanding -> https://www.mstsolutions.com/technical/preventing-duplicate-records-based-on-multiple-fields-in-salesforce/
Also attaching reference for complete guide of duplicate Rules ->https://www.salesforceben.com/salesforce-duplicate-rules/
If it helps please mark this as Best Answer.
Thank you.
could u please scenario how u are getting the List of duplicates
What u can do is create map
Like Map<String,opportunity> oppMap
it will be like this
for(opportunity opp : [Select Id,Name,phonenumber,Email from opportunity]){
String key = opp.Name + '-' + opp.Email + '-' + opp.phonenumber;
oppMap,put(key,opp);
}
In this oppMap u will add in the keyset which will be always unique
so next time similar value came it will not add in the map because u already have those values in Map.
Hope it clears your query.