• Rajashri
  • NEWBIE
  • 125 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 86
    Questions
  • 135
    Replies

 i am trying to add Phone and Status field from Campaign Members Object to my VF page.How can i modify my for loop if i want to print Phone and Status field from campaign Members.

Below is my for loop

 for(Campaign c :[Select ID,(SELECT Id,CampaignId,Status  FROM CampaignMembers where CampaignId =:camp.Id) FROM campaign WHERE id=:camp.Id ]){
                   
              
              for(Lead ld : CampaignMembers) {
                   
              
                         if ((ld.ActivityHistories.size() == 0) || ld.ActivityHistories.size() == null) {
                      
                        lMemberWrappers.add(new MemberWrapper(ld.Phone,ld.CampaignMembers.get(0).Status));
                       
                        }}}

and SOQL Query is

CampaignMembers= [Select Id, Phone,(Select id, Status From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
Hi,

I am trying  to add Status value for wrapper class.Can anyone please tell me how to fetch the status value from Subquery and add it to wrapper class.Below code is giving me Invalid relationship error for highlighted line

for(Lead ld : CampaignMembers) {
                                   if ((ld.ActivityHistories.size() == 0) || ld.ActivityHistories.size() == null) {
                        lMemberWrappers.add(new MemberWrapper(ld.Phone, ld.getSObject('CampaignMembers').get('Status')));
                      
                        }



 [Select Id, Phone,(Select id, Status From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
 
Hi,

I am trying to retrieve the Status data from Inner Query but i am getting an error that 

"Content cannot be displayed: Invalid relationship CampaignMembers for Lead" 
Can anyone please help me on this? I have highlighted the line for which i am getting an error.

public with sharing class CampaignView {
public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
      public DateTime startDate{get;set;}  
    public CampaignView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
       startDate=null;
     for(Campaign c :[Select ID,(SELECT Id,CampaignId,Status  FROM CampaignMembers where CampaignId =:camp.Id) FROM campaign WHERE id=:camp.Id ]){
              for(Lead ld : CampaignMembers) {
              for (ActivityHistory ah : ld.getSObjects('ActivityHistories')) {
                       lMemberWrappers.add(new MemberWrapper(ld.Phone, ld.getSObject('CampaignMembers').get('Status')));
           }}}}
       private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,MobilePhone,Email, LastModifiedDate,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,LeadID,ContactID,Lead.Phone,Lead.Email, Lastmodifieddate,Lead.LastmodifiedDate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone  From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
        return CampaignMembers;
    }    
        public class MemberWrapper {
        public Object Status {get; set;}
                public String Phone {get; set;}
           
        public MemberWrapper(String Phone,Object Status ) {
             this.Phone = Phone;
                 this.Status = Status;
        }}}
 
Hi, 
I am trying to retrieve the Status value from the SubQuery and wanted to add that value in my Wrapper List.Can anyone please tell me how to retrieve the Status Value from Subquery.Status field is available in Campaign Members.

Below is my controller code

public with sharing class CampaignView {
public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
    public DateTime startDate{get;set;}  
    public CampaignView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
       startDate=null;
              for(Lead ld : CampaignMembers) {
                        
              for (ActivityHistory ah : ld.getSObjects('ActivityHistories')) {
            lMemberWrappers.add(new MemberWrapper( ld.Name,cm.Status));
           }}}
       private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,MobilePhone,Email, LastModifiedDate,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,LeadID,ContactID,Lead.Phone,Lead.Email, Lastmodifieddate,Lead.LastmodifiedDate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone  From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
        return CampaignMembers;
    }    
    public class MemberWrapper {
        public String Status {get; set;}
        public String Name {get; set;}
        public MemberWrapper(String Name,String Status ) {
            this.Name = Name;
                 this.Status = Status;
        }}}
    
 

I am trying to  display all the Leads and it's Activity History on my Campaign Members Custom Screen  but my code is showing only those Leads which hasActivity History associated and it's not showing the leads those don't have Activity History Logged.

if the Lead does not have any Activities associated, How to display Leads and Activity History?

Can anyone please tell me How can i modify my below code?

public with sharing class CampaignView {
public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
        public CampaignView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
                  for(Lead ld : CampaignMembers) {
             for(ActivityHistory ah: ld.ActivityHistories){
                lMemberWrappers.add(new MemberWrapper(ld.Phone, ah.Subject));
                   }
        }
        }
    private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,MobilePhone,Email, LastModifiedDate,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,LeadID,ContactID,Lead.Phone,Lead.Email, Lastmodifieddate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone  From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate desc LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
        return CampaignMembers;
    }    
    public class MemberWrapper {
       
        public String Phone {get; set;}
            public String Subject{get;set;}
            public Datetime LastActivityHistory {get; set;}
        public MemberWrapper(String Phone,String Subject ) {
            this.Phone = Phone;
                 this.Subject=Subject;
        }
    }
}
Hi,

I am trying to add the "Subject" Field for Lead from "Lead Activity History" table but i am getting an error that
"Invalid foreign key relationship: Lead.ActivityHistories" Can anyone please tell me how to add the Subject field in list.

Below is my code

public with sharing class singleListView {
    public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
        public singleListView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
        getContactMembers();
        for(Lead ld : CampaignMembers) {
                    lMemberWrappers.add(new MemberWrapper(ld.Phone,ld.ActivityHistories.Subject));
                 
        }
        
    }
      private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,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 IN(select LeadId from campaignMember where campaignId =:camp.Id ) order by LastModifiedDate desc];
        return CampaignMembers;
    }     
         
   
    public class MemberWrapper {
               public String Phone {get; set;}
        public String Subject{get;set;}
        public MemberWrapper(String Phone,String Subject ) {
            this.Phone = Phone;
            this.Subject=Subject;
              }
       }
}
Hi,

I have two pageblock table to display the data from two different variables.Can anyone please guide me how can i show the data in single table.

Below is my code

<apex:page StandardController="Campaign"  extensions="singleListView">
<apex:form >
        <apex:pageBlock mode="maindetail" >
                      <apex:pageblocktable value="{!CampaignMembers}" var="cm">
                 
                 <apex:column headerValue="Phone">
                           <apex:repeat value="{!cm.CampaignMembers}" var="cpm"> 
                             <apex:outputfield value="{!cpm.Lead.Phone}" />
                              </apex:repeat>
                               </apex:column>
                                                   
            </apex:pageblocktable>
 
            <apex:pageBlockTable value="{!ContactMembers}" var="cmc">
                            <apex:column headerValue="Phone">
                           <apex:repeat value="{!cmc.CampaignMembers}" var="cpmc"> 
                            <apex:outputfield value="{!cpmc.Contact.Phone}" rendered="{!cpmc.Contact.Phone != null}"/>
                            </apex:repeat>
                            </apex:column>
                          </apex:pageBlockTable> 
              
                        </apex:pageBlock>   
    
    </apex:form>
</apex:page>
Hi.

I am new to SFDC. i have a requirement that on button click, create the activity to Activity History table with subject line  "Left" value.
Can anyone please tell me how to do it?

 <apex:commandButton value="VM1"  action="{!vm1insert}"/>   

public with sharing class singleListView {
public PageReference vm1insert() {
        return null;
    }
}
Hi,

I am getting an error Unsupported attribute - action for outputlink.Can anyone please help me to resolve that?
Below is my code



 <apex:outputlink action="{!delCampaign}" href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!cpmc.Id}');" style="font-weight:bold">Del
     <apex:param name="contIdParam" value="{!cpmc.Id}" assignTo="{!RowCampaignId}"/>
</apex:outputlink>

public PageReference delCampaign()
{
    Campaign DeleteCampaign=new Campaign(id=RowCampaignId);
   delete DeleteCamapign;
    return null;
Hi

I have created the output link for Edit/Remove

Can anyone please send me code ...how to delete the record  using Output link ?

 <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!row.Id}');" style="font-weight:bold">Del</a>
Hi,

I have designed the Visual Force page but in my page Header is repetative for each record..Can anyone please tell me how to modify this page so that it will show only one header row..

Below is my Page
<apex:page StandardController="Campaign"  extensions="singleListView">
<apex:form >
        <apex:pageBlock title="Campaign Members Details New Modified Code For Lead Ids" mode="maindetail">
                                <apex:pageBlockSection title="Campaign Members"  id="cm3">
                      

                <apex:pageblocktable value="{!CampaignMembers}" var="cm">
                <!-- <apex:column headerValue="Name">
                                 <apex:outputfield value="{!cm.Name}"/>
                                  </apex:column>-->

                           <apex:column >
              

                               <apex:pageblocktable value="{!cm.CampaignMembers}" var="cpm"> 
                                 <apex:column headerValue="Action">
                               
                          
       <apex:outputLink title="" value="/{!cpm.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteCampaignId('{!cpm.Id}');" style="font-weight:bold">Del</a>
     </apex:column>
                           

                                   <apex:column headerValue="Status">

                                       <apex:outputfield value="{!cpm.Status}" rendered="{!cpm.Status != null}"/>

                                    </apex:column> 
                                   
                                  <apex:column headerValue="Name">
                                 <apex:outputfield value="{!cpm.LeadID}" rendered="{!cpm.LeadID != null}"/>
                                  </apex:column>
                                  <apex:column headerValue="Phone">
                                 <apex:outputfield value="{!cpm.Lead.Phone}" rendered="{!cpm.Lead.Phone != null}"/>
                                  </apex:column>
                                    <apex:column headerValue="Mobile">
                                 <apex:outputfield value="{!cpm.Lead.MobilePhone}" />
                                  </apex:column>  
                                  <apex:column headerValue="Email">
                                 <apex:outputfield value="{!cpm.Lead.Email}" rendered="{!cpm.Lead.Email != null}"/>
                                  </apex:column>
                                  <apex:column headerValue="Last Modified Date">
                                 <apex:outputfield value="{!cpm.lastmodifieddate}" rendered="{!cpm.lastmodifieddate != 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:column headerValue="Last Modified Date">
                               <apex:outputfield value="{!tm.LastmodifiedDate}" rendered="{!tm.LastmodifiedDate != null}"/>
                         </apex:column>

                               </apex:pageblocktable>

                           </apex:column>

            </apex:pageblocktable>

            
                         </apex:pageBlockSection>
        </apex:pageBlock>

    </apex:form>

</apex:page>
Hi,

i am trying to print the campaign member list in my vf page but it's giving me an error
Can anyone please help me?
below is my code..
<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>
 
 
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 );
        }  
    } 

}
Hi,

I am trying to print the campaign Member List in VF page but i am getting an error that 
Unknown Property  "Unknown property 'CampaignStandardController.cm'" can anyone please help me
below is my VF page and Controller code

<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="com">
                        <apex:column headerValue="Name">
                            <apex:outputfield value="{!lcom.Id}" />
                        </apex:column>
    
   </apex:pageblocktable>
                      </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
 
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 );
        }  
    } 

}
 
Hi,,
I am trying to design the VF page for below controller but my VF page is giving an error...

Error: Invalid field CampaignMembers for SObject CampaignMember 


Can anyone 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>

Controller Code
public with sharing class CampaignMemController {
    public Campaign camp {
        get;
        set;
    }
    public List<Lead> leads {
        get;
        set;
    }   
        
    public List<CampaignMember> campaignMembers {
        get;
        set;
    }           
               
    public CampaignMemController(ApexPages.StandardController controller) {
        this.camp = (Campaign) controller.getRecord();
        this.campaignMembers = [
            select
                CampaignId,
                LeadId,
                Status
            from CampaignMember
            where CampaignId = :this.camp.Id and
                Status != ''
        ];      

        Set<Id> leadIds = new Set<Id>();

        for (CampaignMember member: this.campaignMembers) {
            leadIds.add(member.LeadId);
        }
        leadIds.remove(null);
        this.leads = new List<Lead>();
        if (!leadIds.isEmpty()) {
            this.leads = [
                select Email,
                    FirstName,
                    LastName,
                    MobilePhone,
                    Name,
                    Phone,
                    (
                        select Subject,
                           
                        from ActivityHistories
                        where lastModifiedDate != null and
                            Subject != null
                        order by LastModifiedDate desc
                        limit 1
                    )
                from Lead
                where Id in :leadIds
            ];
        }
    }
}
Hi,

I am trying to assign the lead id but i am getting the error as  Initial term of field expression must be a concrete SObject: LIST<Lead> 

Can anyone Please help?
public with sharing class CampaignMemController {
    public Campaign camp {get; set; }
    public CampaignMemController(ApexPages.StandardController controller) {
     camp = (Campaign)controller.getRecord();
    }
   public List<Lead> lead;
   public List<Lead> leadlist = new list<Lead>();
    public List<Lead> cmlist;
    public List<Lead> getLead() {
        if(lead == null) {
           lead = [SELECT Id,Name FROM Lead];
          
        }
            return lead;
         }
    public List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
     CampaignMembers=[Select Id,Name,(SELECT id, contactid FROM campaignmembers WHERE Id = :camp.Id AND LeadId != null ) from Lead WHERE Id= :lead.id ];
        return CampaignMembers;
       }
       
    
    }
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 );
        }  
    } 

}
Hi,
I am new to Apex..I am trying to write the below controller code but i am getting an error that..expecting right curly bracket, found 'for' 

Can anyone please help?

public with sharing class CampaignMemController {

    public Campaign camp {get; set; }
    list<contact> con = new list<contact>();
    public CampaignMemController(ApexPages.StandardController controller) {
     camp = (Campaign)controller.getRecord();
    }
    for(contact con:[select name,id,(select id from CampaignMembers) from contact]){
     List<CampaignMember > camList = New List<CampaignMember>();
     for(CampaignMember camp: con.CampaignMembers){
     camList.add(camp);
}
System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
Hi,

I want to see Lead/Contact details along with the campaign member record, as well as the activityhistory. 

an anyone please send me code? or Any help Link..

Thanks
Hi

How can i set the parameter value in controller to Test my below code.

public with sharing class singleListView {
    public Campaign camp {get; set; }
    Public Lead lead{get;set;}
    List<CampaignMember>  CampaignMember = new List<CampaignMember>(); 
    public singleListView(ApexPages.StandardController controller) {
       camp = (Campaign)controller.getRecord();
       
          
          
           System.debug(camp.Id);
           
    }
    public List<Schema.Lead> CampaignMembers;
    public List<Schema.Lead> getCampaignMembers() {
       System.debug(camp.Id);
   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='00Q90000008fA5OEAU' order by LastModifiedDate desc];
       return CampaignMembers;
 
         }     
          }
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;
       
     }
         }     
         
Hi,

I am getting an error Unsupported attribute - action for outputlink.Can anyone please help me to resolve that?
Below is my code



 <apex:outputlink action="{!delCampaign}" href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!cpmc.Id}');" style="font-weight:bold">Del
     <apex:param name="contIdParam" value="{!cpmc.Id}" assignTo="{!RowCampaignId}"/>
</apex:outputlink>

public PageReference delCampaign()
{
    Campaign DeleteCampaign=new Campaign(id=RowCampaignId);
   delete DeleteCamapign;
    return null;

 i am trying to add Phone and Status field from Campaign Members Object to my VF page.How can i modify my for loop if i want to print Phone and Status field from campaign Members.

Below is my for loop

 for(Campaign c :[Select ID,(SELECT Id,CampaignId,Status  FROM CampaignMembers where CampaignId =:camp.Id) FROM campaign WHERE id=:camp.Id ]){
                   
              
              for(Lead ld : CampaignMembers) {
                   
              
                         if ((ld.ActivityHistories.size() == 0) || ld.ActivityHistories.size() == null) {
                      
                        lMemberWrappers.add(new MemberWrapper(ld.Phone,ld.CampaignMembers.get(0).Status));
                       
                        }}}

and SOQL Query is

CampaignMembers= [Select Id, Phone,(Select id, Status From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
Hi,

I am trying  to add Status value for wrapper class.Can anyone please tell me how to fetch the status value from Subquery and add it to wrapper class.Below code is giving me Invalid relationship error for highlighted line

for(Lead ld : CampaignMembers) {
                                   if ((ld.ActivityHistories.size() == 0) || ld.ActivityHistories.size() == null) {
                        lMemberWrappers.add(new MemberWrapper(ld.Phone, ld.getSObject('CampaignMembers').get('Status')));
                      
                        }



 [Select Id, Phone,(Select id, Status From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
 
Hi, 
I am trying to retrieve the Status value from the SubQuery and wanted to add that value in my Wrapper List.Can anyone please tell me how to retrieve the Status Value from Subquery.Status field is available in Campaign Members.

Below is my controller code

public with sharing class CampaignView {
public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
    public DateTime startDate{get;set;}  
    public CampaignView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
       startDate=null;
              for(Lead ld : CampaignMembers) {
                        
              for (ActivityHistory ah : ld.getSObjects('ActivityHistories')) {
            lMemberWrappers.add(new MemberWrapper( ld.Name,cm.Status));
           }}}
       private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,MobilePhone,Email, LastModifiedDate,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,LeadID,ContactID,Lead.Phone,Lead.Email, Lastmodifieddate,Lead.LastmodifiedDate,Status,CampaignId,Campign_ID__c,Lead.MobilePhone  From CampaignMembers where CampaignId =:camp.Id  ),
        (Select Subject, Id,lastModifiedDate From ActivityHistories    order by LastModifiedDate DESC  LIMIT 1  )
        From Lead  where Id IN(select LeadId from campaignMember where campaignId =:camp.Id ) ];
        return CampaignMembers;
    }    
    public class MemberWrapper {
        public String Status {get; set;}
        public String Name {get; set;}
        public MemberWrapper(String Name,String Status ) {
            this.Name = Name;
                 this.Status = Status;
        }}}
    
 
Hi,

I am trying to add the "Subject" Field for Lead from "Lead Activity History" table but i am getting an error that
"Invalid foreign key relationship: Lead.ActivityHistories" Can anyone please tell me how to add the Subject field in list.

Below is my code

public with sharing class singleListView {
    public Campaign camp {get; set; }
    public List<MemberWrapper> lMemberWrappers {get; set;}
        public singleListView(ApexPages.StandardController controller) {
        camp = (Campaign)controller.getRecord();
        lMemberWrappers = new List<MemberWrapper>();
        getCampaignMembers();
        getContactMembers();
        for(Lead ld : CampaignMembers) {
                    lMemberWrappers.add(new MemberWrapper(ld.Phone,ld.ActivityHistories.Subject));
                 
        }
        
    }
      private List<Lead> CampaignMembers;
    public List<Lead> getCampaignMembers() {
        CampaignMembers = [Select Id,Name, Phone,(Select id, Campaign.Name,Contact.Phone,Lead.FirstName,Lead.LastName,Lead.Name,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 IN(select LeadId from campaignMember where campaignId =:camp.Id ) order by LastModifiedDate desc];
        return CampaignMembers;
    }     
         
   
    public class MemberWrapper {
               public String Phone {get; set;}
        public String Subject{get;set;}
        public MemberWrapper(String Phone,String Subject ) {
            this.Phone = Phone;
            this.Subject=Subject;
              }
       }
}
Hi,

I have two pageblock table to display the data from two different variables.Can anyone please guide me how can i show the data in single table.

Below is my code

<apex:page StandardController="Campaign"  extensions="singleListView">
<apex:form >
        <apex:pageBlock mode="maindetail" >
                      <apex:pageblocktable value="{!CampaignMembers}" var="cm">
                 
                 <apex:column headerValue="Phone">
                           <apex:repeat value="{!cm.CampaignMembers}" var="cpm"> 
                             <apex:outputfield value="{!cpm.Lead.Phone}" />
                              </apex:repeat>
                               </apex:column>
                                                   
            </apex:pageblocktable>
 
            <apex:pageBlockTable value="{!ContactMembers}" var="cmc">
                            <apex:column headerValue="Phone">
                           <apex:repeat value="{!cmc.CampaignMembers}" var="cpmc"> 
                            <apex:outputfield value="{!cpmc.Contact.Phone}" rendered="{!cpmc.Contact.Phone != null}"/>
                            </apex:repeat>
                            </apex:column>
                          </apex:pageBlockTable> 
              
                        </apex:pageBlock>   
    
    </apex:form>
</apex:page>
Hi,

I am getting an error Unsupported attribute - action for outputlink.Can anyone please help me to resolve that?
Below is my code



 <apex:outputlink action="{!delCampaign}" href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!cpmc.Id}');" style="font-weight:bold">Del
     <apex:param name="contIdParam" value="{!cpmc.Id}" assignTo="{!RowCampaignId}"/>
</apex:outputlink>

public PageReference delCampaign()
{
    Campaign DeleteCampaign=new Campaign(id=RowCampaignId);
   delete DeleteCamapign;
    return null;
Hi

I have created the output link for Edit/Remove

Can anyone please send me code ...how to delete the record  using Output link ?

 <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!row.Id}');" style="font-weight:bold">Del</a>
Hi,

I have designed the Visual Force page but in my page Header is repetative for each record..Can anyone please tell me how to modify this page so that it will show only one header row..

Below is my Page
<apex:page StandardController="Campaign"  extensions="singleListView">
<apex:form >
        <apex:pageBlock title="Campaign Members Details New Modified Code For Lead Ids" mode="maindetail">
                                <apex:pageBlockSection title="Campaign Members"  id="cm3">
                      

                <apex:pageblocktable value="{!CampaignMembers}" var="cm">
                <!-- <apex:column headerValue="Name">
                                 <apex:outputfield value="{!cm.Name}"/>
                                  </apex:column>-->

                           <apex:column >
              

                               <apex:pageblocktable value="{!cm.CampaignMembers}" var="cpm"> 
                                 <apex:column headerValue="Action">
                               
                          
       <apex:outputLink title="" value="/{!cpm.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteCampaignId('{!cpm.Id}');" style="font-weight:bold">Del</a>
     </apex:column>
                           

                                   <apex:column headerValue="Status">

                                       <apex:outputfield value="{!cpm.Status}" rendered="{!cpm.Status != null}"/>

                                    </apex:column> 
                                   
                                  <apex:column headerValue="Name">
                                 <apex:outputfield value="{!cpm.LeadID}" rendered="{!cpm.LeadID != null}"/>
                                  </apex:column>
                                  <apex:column headerValue="Phone">
                                 <apex:outputfield value="{!cpm.Lead.Phone}" rendered="{!cpm.Lead.Phone != null}"/>
                                  </apex:column>
                                    <apex:column headerValue="Mobile">
                                 <apex:outputfield value="{!cpm.Lead.MobilePhone}" />
                                  </apex:column>  
                                  <apex:column headerValue="Email">
                                 <apex:outputfield value="{!cpm.Lead.Email}" rendered="{!cpm.Lead.Email != null}"/>
                                  </apex:column>
                                  <apex:column headerValue="Last Modified Date">
                                 <apex:outputfield value="{!cpm.lastmodifieddate}" rendered="{!cpm.lastmodifieddate != 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:column headerValue="Last Modified Date">
                               <apex:outputfield value="{!tm.LastmodifiedDate}" rendered="{!tm.LastmodifiedDate != null}"/>
                         </apex:column>

                               </apex:pageblocktable>

                           </apex:column>

            </apex:pageblocktable>

            
                         </apex:pageBlockSection>
        </apex:pageBlock>

    </apex:form>

</apex:page>
Hi,

i am trying to print the campaign member list in my vf page but it's giving me an error
Can anyone please help me?
below is my code..
<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>
 
 
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 );
        }  
    } 

}
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 );
        }  
    } 

}
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;
       
     }
         }