You need to sign in to do that
Don't have an account?
Rajashri
Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> at line 6
Hi,
I am getting the error "Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> at line 6 "
Can nyone please help?
public with sharing class CampaignMemController {
public Campaign camp {get; set; }
list<contact> con = [SELECT id FROM contact];
list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
list<contact> conlist = new list<contact>();
public CampaignMemController(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
for(campaignmember cm : cmlist)
{
for(contact c : con)
{
if(c.id == cm.contactid)
conlist.add(c);
}
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
}
I am getting the error "Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> at line 6 "
Can nyone please help?
public with sharing class CampaignMemController {
public Campaign camp {get; set; }
list<contact> con = [SELECT id FROM contact];
list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
list<contact> conlist = new list<contact>();
public CampaignMemController(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
for(campaignmember cm : cmlist)
{
for(contact c : con)
{
if(c.id == cm.contactid)
conlist.add(c);
}
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
}
I tried it and it's getting save without any error.
Thanks,
Pratik
Thanks a lot!
i am still getting an error...
Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> for this line
list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
Can you please copy and paste your code?
Use CampaignMember instead campaignmember in the line where you are getting error and let me know if it works?
I tried that but still i am getting an error..
Thanks
I am trying to print the campaign members in VF page and i am getting an error
Unknown Property "Unknown property 'CampaignStandardController.cm'"
Can you please help?
<apex:page StandardController="Campaign" extensions="CampaignMemController">
<apex:form >
<apex:pageBlock title="Campaign Members Details" mode="maindetail">
<apex:pageBlockSection title="Campaign Members" id="cm3">
<apex:pageblocktable value="{!cm}" var="lead">
<apex:column headerValue="Name">
<apex:outputfield value="{!lead.Id}" />
</apex:column>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
The issue is, you are using variable name insted of method name. The "cm" is variable in your class, for now i have put it as "camp" as it's method in the below bold part.
<apex:page StandardController="Campaign" extensions="CampaignMemController">
<apex:form >
<apex:pageBlock title="Campaign Members Details" mode="maindetail">
<apex:pageBlockSection title="Campaign Members" id="cm3">
<apex:pageblocktable value="{!camp}" var="lead">
<apex:column headerValue="Name">
<apex:outputfield value="{!lead.Id}" />
</apex:column>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hope this will help you to resolve your issue.
Thanks,
Pratik
How can i do that?