You need to sign in to do that
Don't have an account?
sachitanand kumar
Hi All, I write a class for vf page for display duplicate lead in vf page.i got the Error: leaddup Compile Error: Illegal assignment from List<AggregateResult> to List<Lead> . i m basically admin so i can't understand about error any help appreciated
This is class
-------------------------------------------------------------------------
public class leaddup {
public List<lead>ac{get;set;}
public leaddup(){
ac =[SELECT name,email FROM lead ];
}
public void getbyname(){
ac=[SELECT name,count(Id) FROM lead GROUP BY name HAVING count(Id)>1];
}
public void getbyemail(){
ac=[SELECT email,count(Id) FROM lead GROUP BY email HAVING count(Id)>1];
}
}
--------------------------------------------------
This is vf
---------------------------------------------------------------------
<apex:page controller="leaddup">
<apex:form >
<apex:pageblock title="Duplicate lead">
<apex:pageBlockButtons >
<apex:commandButton value="based on name" action="{!getbyname}"/>
<apex:commandButton value="based on email" action="{!getbyemail}"/>
</apex:pageBlockButtons>
<apex:PageBlockTable value="{!ac}" var="a">
<apex:Column value="{!a.Name}"/>
<apex:Column value="{!a.email}"/>
</apex:PageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
-------------------------------------------------------------------------
public class leaddup {
public List<lead>ac{get;set;}
public leaddup(){
ac =[SELECT name,email FROM lead ];
}
public void getbyname(){
ac=[SELECT name,count(Id) FROM lead GROUP BY name HAVING count(Id)>1];
}
public void getbyemail(){
ac=[SELECT email,count(Id) FROM lead GROUP BY email HAVING count(Id)>1];
}
}
--------------------------------------------------
This is vf
---------------------------------------------------------------------
<apex:page controller="leaddup">
<apex:form >
<apex:pageblock title="Duplicate lead">
<apex:pageBlockButtons >
<apex:commandButton value="based on name" action="{!getbyname}"/>
<apex:commandButton value="based on email" action="{!getbyemail}"/>
</apex:pageBlockButtons>
<apex:PageBlockTable value="{!ac}" var="a">
<apex:Column value="{!a.Name}"/>
<apex:Column value="{!a.email}"/>
</apex:PageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Your code has to be like this below. Let me know if this works.
All Answers
Please try this code,
Apex Code :
Visualforce Code :
Thanks
Prosenjit
Your code has to be like this below. Let me know if this works.