You need to sign in to do that
Don't have an account?
Rajashri
Compile Error: Initial term of field expression must be a concrete SObject: LIST<Lead>
Hi
For below code i am getting the error Initial term of field expression must be a concrete SObject: LIST<Lead>
Can anyone please help?
Below is my code
public with sharing class singleListView {
public Campaign camp {get; set; }
public List<Lead> lead {get;set;}
public singleListView(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
}
private List<Schema.Lead> CampaignMembers;
public List<Schema.Lead> getCampaignMembers() {
CampaignMembers=[Select Id,Name,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,LeadID,Lead.Phone,Lead.Email, Lastmodifieddate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone From CampaignMembers where CampaignId =:camp.Id and Status != '' and LeadId != null),
(Select Subject, Id,lastModifiedDate From ActivityHistories where lastModifiedDate !=null and Subject !=null order by LastModifiedDate desc limit 1)
From Lead where Name !=NULL and Id= :lead.Id order by LastModifiedDate desc];
return CampaignMembers;
}
}
For below code i am getting the error Initial term of field expression must be a concrete SObject: LIST<Lead>
Can anyone please help?
Below is my code
public with sharing class singleListView {
public Campaign camp {get; set; }
public List<Lead> lead {get;set;}
public singleListView(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
}
private List<Schema.Lead> CampaignMembers;
public List<Schema.Lead> getCampaignMembers() {
CampaignMembers=[Select Id,Name,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,LeadID,Lead.Phone,Lead.Email, Lastmodifieddate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone From CampaignMembers where CampaignId =:camp.Id and Status != '' and LeadId != null),
(Select Subject, Id,lastModifiedDate From ActivityHistories where lastModifiedDate !=null and Subject !=null order by LastModifiedDate desc limit 1)
From Lead where Name !=NULL and Id= :lead.Id order by LastModifiedDate desc];
return CampaignMembers;
}
}
I am trying to display campaign members and associated lead history..
Can you please help?
Below is my controller code..
public with sharing class CampaignMemController {
public Campaign camp {get; set; }
public CampaignMemController(ApexPages.StandardController controller) {
camp = (Campaign)controller.getRecord();
}
public List<Lead> lead= [SELECT Id,Name FROM Lead];
public List<Lead> leadlist = new list<Lead>();
public List<CampaignMember> cmlist= new List<CampaignMember>();
public List<Lead> CampaignMembers;
public List<Lead> getCampaignMembers() {
CampaignMembers=[Select Id,Name,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,LeadID,ContactID,Lead.Phone,Lead.Email, Lastmodifieddate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone From CampaignMembers where CampaignId =:camp.Id and Status != ''),
(Select Subject, Id,lastModifiedDate From ActivityHistories where lastModifiedDate !=null and Subject !=null order by LastModifiedDate desc limit 1) from Lead where ID=:lead[0].id];
return CampaignMembers;
}
}
You could probably reduce this down into one query and then build a list of leads off the queried items, but I'm not sure it's worth the headache and possible future confusion to save a single query in the controller.
NOTE: This code has not been tested and may contain typographical or logical errors.
Illegal assignment from LIST<CampaignMember> to LIST<CampaignMember> at line 19 column 9
How can i resolve that error?
what changes i need to do to get this code work there..
Also i am now trying to print the values in sandbox VF page...but getting error that
Error: Invalid field CampaignMembers for SObject CampaignMember
can you please help ?
Below is my VF page...
<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="{!CampaignMembers}" var="cm">
<apex:column >
<apex:pageblocktable value="{!cm.CampaignMembers}" var="cpm">
<apex:column headerValue="Name">
<apex:outputfield value="{!cpm.LeadID}" rendered="{!cpm.LeadID != null}"/>
</apex:column>
</apex:pageblocktable>
</apex:column>
<apex:column >
<apex:pageblocktable value="{!cm.ActivityHistories}" var="tm">
<apex:column headerValue="Subject">
<apex:outputfield value="{!tm.Subject}" rendered="{!tm.Subject != null}"/>
</apex:column>
</apex:pageblocktable>
</apex:column>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
If you need the data presented differently then you will need to make a custom data structure to map the data how you want.
The CapaignMembers, the Leads and the ActivityHistory data ...from the above controller to visual force page but it is not showing me any data...
The CapaignMembers, the Leads and the ActivityHistory data ...from the above controller to visual force page