Skip to main content
added 59 characters in body
Source Link
ncmouli
  • 310
  • 3
  • 17

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

i want to update Result field True for Selected records in CampaignMember Please help on this

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

added 3335 characters in body
Source Link
ncmouli
  • 310
  • 3
  • 17

I would likei want to create a List view pageupdate Result field True for Selected records in CampaignMember can any onePlease help to achieveon this requirement.

Page:

<apex:page controller="Checkbox_Member" Tabstyle="Campaign"> <apex:form > <apex:pageBlock Title="CampaignMember with CheckBoxes">

      <apex:pageBlockButtons >
        <apex:commandButton value="Approve" action="{!Approve}"/>
        <apex:commandButton value="Reject"/>
    </apex:pageBlockButtons>
      
      <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>
                    </apex:facet>
                    <apex:inputCheckbox value="{!a.selected}" id="checkedone">                   
                    <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
          </apex:column>
          <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:pageBlockTable>
      <apex:panelGrid columns="2">
        <apex:commandLink action="{!previous}">Previous</apex:commandlink>
        <apex:commandLink action="{!next}">Next</apex:commandlink>
     </apex:panelGrid>
  </apex:pageBlock>

</apex:form>

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

</apex:page>

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()
{
    selectedAccounts.clear();
    for(accountwrapper accwrapper : accountList)
    if(accwrapper.selected == true)
    selectedAccounts.add(accwrapper.acc);
    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;
}

}

I would like to create a List view page for CampaignMember can any one help to achieve this requirement.

i want to update Result field True for Selected records in CampaignMember Please help on this

Page:

<apex:page controller="Checkbox_Member" Tabstyle="Campaign"> <apex:form > <apex:pageBlock Title="CampaignMember with CheckBoxes">

      <apex:pageBlockButtons >
        <apex:commandButton value="Approve" action="{!Approve}"/>
        <apex:commandButton value="Reject"/>
    </apex:pageBlockButtons>
      
      <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>
                    </apex:facet>
                    <apex:inputCheckbox value="{!a.selected}" id="checkedone">                   
                    <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
          </apex:column>
          <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:pageBlockTable>
      <apex:panelGrid columns="2">
        <apex:commandLink action="{!previous}">Previous</apex:commandlink>
        <apex:commandLink action="{!next}">Next</apex:commandlink>
     </apex:panelGrid>
  </apex:pageBlock>

</apex:form>

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

</apex:page>

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()
{
    selectedAccounts.clear();
    for(accountwrapper accwrapper : accountList)
    if(accwrapper.selected == true)
    selectedAccounts.add(accwrapper.acc);
    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;
}

}

deleted 20 characters in body; edited tags
Source Link
Samuel De Rycke
  • 9.6k
  • 8
  • 46
  • 73

I would like to create a List view page for CampaignMember can any one help to achieve this requirement.

Thanks in advance.

I would like to create a List view page for CampaignMember can any one help to achieve this requirement.

Thanks in advance.

I would like to create a List view page for CampaignMember can any one help to achieve this requirement.

Source Link
ncmouli
  • 310
  • 3
  • 17
Loading