function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

find duplicates in contact

in account we have contacts ,for contacts emails are there ok fine. now i want emails of contacts of all accounts.if email is duplicated then corresponing account name will be display on visual force page (urgent )

This can be achieved through SOQL, have you written the code for the Visualforce page? Please share if you have the code.

if not, I'd suggest you to go through the following and try to build the query - if you face any issues, you can post it here. 
public with sharing class accountconemailmap1 {
public List<contact> dupcon{set;get;}
public List<account>  acc{set;get;}
List<string> ids;
integer count=0;

public accountconemailmap1()
acc=[select name from account];

set<id> accountid=new set<id>();

for(account a:acc)

Map<string,List<Contact>> m = new Map<string,List<Contact>>();
    List<contact> cont =[select id, lastname,email from contact where accountid in :accountid];
    for(contact c :cont)
    m.put(, new list<contact>{c});
   for(string nodup:m.KeySet())
    /*for(string nodup:m.KeySet())
     contains =m.containsKey(nodup); 

in controller i wrote like this here in map is contains emails as ids,list contacts as values .so here id are unique we have to compare email of keys with list contact email if email matches for two times then that is duplicate one.i tryed like this but not get it do any modification and find list of contacts which are having duplicate emails.