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
aswanijagadesh1.397398535585991E12aswanijagadesh1.397398535585991E12 

find duplicates in contact

hai 
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 )
Sonam_SFDCSonam_SFDC
Hi,

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 http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql.htm and try to build the query - if you face any issues, you can post it here. 
aswanijagadesh1.397398535585991E12aswanijagadesh1.397398535585991E12
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)
{
accountid.add(a.id);
}

Map<string,List<Contact>> m = new Map<string,List<Contact>>();
   system.debug('44444333'+m);
    List<contact> cont =[select id, lastname,email from contact where accountid in :accountid];
 
  
    for(contact c :cont)
    {
    m.put(c.email, new list<contact>{c});
    }
 
   for(string nodup:m.KeySet())
    {       
     dupcon=m.get(nodup);
     system.debug('555555'+dupcon);
     }
    
 
    /*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.