i want to update Result field = True for Selected(Check box =true) records in CampaignMember once i click on Approve Button in page. Please help on this


      <apex:pageBlockButtons >
        <apex:commandButton value="Approve" action="{!Approve}"/>
        <apex:commandButton value="Reject"/>

      <apex:pageBlockTable value="{!CampaignMember}" var="a" id="opp_table">

          <apex:column >
                    <apex:facet name="header" > <apex:inputCheckbox title=""  >   SELECT ALL
                        <apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
                    <apex:inputCheckbox value="{!a.selected}" id="checkedone">                   
                    <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
          <apex:column headervalue="CampaignName" value="{!a.acc.Campaign.Name}" />
          <apex:column headervalue="MemberName" value="{!a.acc.Contact.LastName}" />
          <apex:column headervalue="Approval_by_Campaign_Admin" value="{!a.acc.Approval_by_Campaign_Admin__c}" />
          <apex:column headervalue="Result" value="{!a.acc.Result__c}" />

      <apex:panelGrid columns="2">
        <apex:commandLink action="{!previous}">Previous</apex:commandlink>
        <apex:commandLink action="{!next}">Next</apex:commandlink>

function checkAll(cb) { var inputElem = document.getElementsByTagName("input"); for(var i=0; i

Controller :

public class Checkbox_Member {

public PageReference Approve() {
    return null;

List<accountwrapper> accountList = new List<accountwrapper>();
List<campaignMember> selectedAccounts = new List<campaignMember>();

public PageReference getSelected()
    for(accountwrapper accwrapper : accountList)
    if(accwrapper.selected == true)
    return null;

public List<accountwrapper> getCampaignMember()
    for(campaignMember a : [select id,Campaign.Name,Contact.LastName,Approval_by_Campaign_Admin__c,Result__c,Action__c from campaignMember])
    accountList.add(new accountwrapper(a));
    return accountList;

public class accountwrapper
    public campaignMember acc{get; set;}
    public Boolean selected {get; set;}
    public accountwrapper(campaignMember a)
        acc = a;
        selected = false;

 public PageReference next() {
    return null;

public PageReference previous() {
    return null;


  • ncmouli questions are usually easier to answer if you explain what you've tried and why you are unable to proceed. Jun 11, 2015 at 8:45

1 Answer 1


This is a standard object which does not have a tab, and custom tabs can only be made for custom objects. This means you can't use the standard list view functionality for this object and will need to use a Visualforce page.

  • how to write a visualforce page to view all campaignmembers
    – ncmouli
    Jun 11, 2015 at 9:26
  • 1
    That's a different question, it's best if you then update your question so that it's obvious for others how they can help you. But if you're not sure how to do that, you may want to search for "how to learn visualforce". Jun 11, 2015 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .