You need to sign in to do that
Don't have an account?
Mahesh Dhara 9
Is anything Wrong with below code?
public class DuplicateLeads {
public List<Lead> leadsList {set;get;}
public List<String> emailList {set;get;}
public Integer count=0;
public DuplicateLeads(){
leadsList=[select email,name from lead];
}
public void BasedOnEmail(){
List<aggregateResult> results=[select count(id)cou,email from lead group by email];
for(AggregateResult ar:results){
count=(Integer)ar.get('cou');
System.debug(count);
if(count>2){
emailList.add((String)ar.get('email'));//values are not added to the list
System.debug(emailList);
}
}
}
}
public List<Lead> leadsList {set;get;}
public List<String> emailList {set;get;}
public Integer count=0;
public DuplicateLeads(){
leadsList=[select email,name from lead];
}
public void BasedOnEmail(){
List<aggregateResult> results=[select count(id)cou,email from lead group by email];
for(AggregateResult ar:results){
count=(Integer)ar.get('cou');
System.debug(count);
if(count>2){
emailList.add((String)ar.get('email'));//values are not added to the list
System.debug(emailList);
}
}
}
}
All Answers
Are you getting any error? Is the code going inside the IF condition?
System.NullPointerException: Attempt to de-reference a null object
Try this may be it will work