• veena vani
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi Guys,

i have a vf page where 2 record types records are displaying with checkbox i should save those selected records .. can you please help me with this
here is my code i not wrote a wrapper class i am not understanding how to do it
public class custInterNeeds {
public PegasysKAM__Account_Plan__c accplan {set;get;}
public list <PegasysKAM__Customer_Need__c> cus {get;set;}
public list <PegasysKAM__Customer_Need__c> cus1 {get;set;}
public PegasysKAM__Customer_Need__c CusNeed {get;set;}
public string pid {get;set;}
public String currentRecordId {get;set;}
  
    public PageReference saveandnew() {
        return null;
    }
    public PageReference save() {
        return null ;
    }
    public PageReference Cancel(){
      PageReference pageRef = new PageReference('/'+'string pid');
       pageRef.setRedirect(true);
       return pageRef;
    }

public custInterNeeds(ApexPages.StandardController controller) {
    
string pid = ApexPages.currentPage().getParameters().get('pid');
     
         
  cus  = [SELECT  ID,Name, PegasysKAM__Account__c,PegasysKAM__Need__c,PegasysKAM__Status__c,PegasysKAM__Year__c,PegasysKAM__Details__c FROM PegasysKAM__Customer_Need__c
                  
                 where PegasysKAM__Account__c = :ApexPages.CurrentPage().getparameters().get('pid') AND RecordType.name='Customer' ];
                 
  cus1  = [SELECT  ID,Name, PegasysKAM__Account__c,PegasysKAM__Need__c,PegasysKAM__Status__c,PegasysKAM__Year__c,PegasysKAM__Details__c FROM PegasysKAM__Customer_Need__c
                  
                 where PegasysKAM__Account__c = :ApexPages.CurrentPage().getparameters().get('pid') AND RecordType.name='Internal' ];
 

    
}
}
<apex:page standardController="Account_Plan__c" Extensions="custInterNeeds" >


 <script type="text/avascript">
    function chkselected(obj,recid)
    {
        var inputcheckbox = document.getelementsbytagname("input");
        for(var i=0; i<inputcheckbox.length; i++){
                if(inputcheckbox[i].id.indexOf(recid)!=-1){
                    inputcheckbox[i].checked = obj.checked;
                }
            }
    }
    </script>
  <apex:form >
  <apex:pageblock title="Account Plan Edit" id="block" mode="edit" > 
  <apex:pageBlockButtons >
  <apex:commandButton value="Save" action="{!save}" />
    <apex:commandButton value="Cancel" action="{!cancel}"/>
    <apex:commandButton value="Save&New" action="{!saveandnew}"/>
  </apex:pageBlockButtons>
  <apex:pageblocksection title="Information">
  <apex:outputField value="{!Account_Plan__c.Account__c}"/>
   <apex:inputField value="{!accplan.Key_Account_Manager__c}"/>
   <apex:inputField value="{!accplan.Start_Date__c}"/>
   <apex:inputField value="{!accplan.Status__c}"/>
   <apex:inputField value="{!accplan.End_Date__c}"/>
   <apex:inputField value="{!accplan.customer_approval__c}"/>
   <apex:inputField value="{!accplan.Customer_Stakeholder__c}"/>  
  </apex:pageblocksection>
  
   <apex:pageBlockSection title="Details">   
   <apex:inputField value="{!accplan.Overall_Objective__c}" style="width:120%;"/><br/>
   <apex:inputField value="{!accplan.Description__c}" style="width:150%;" />    
   </apex:pageBlockSection> 
     
   </apex:pageblock>
   
   <apex:pageBlock >
   
    
   <apex:pageblockSection title="Customer Needs" >
<!--<apex:outputPanel rendered="{!IF(<strong>PegasysKAM__Customer_Need__c</strong>.RecordType.Name == 'Customer')}">-->
 <!--  <apex:outputPanel rendered="{!Account_Plan__c.PegasysKAM__Customer_Need__c.RecordTypeId== '01I2v000003PVvj'}" > -->
   <apex:pageBlockSectionItem dataStyle="width:100%" labelStyle="width:100%" >
   <apex:pageblockTable value="{!cus}" var="c" styleclass="pageblock">
   
            <apex:column headerValue="Account" >
            <apex:outputField value="{!c.Account__c}" />
            </apex:column>
            <apex:column headerValue="Details">
            <apex:outputField value="{!c.Details__c}"/>
            </apex:column>
            <apex:column headerValue="Status">
            <apex:outputField value="{!c.Status__c}"/>
            </apex:column>
            <apex:column headerValue="Need">
            <apex:outputField value="{!c.Need__c}"/>
            </apex:column>
            <apex:column headerValue="Year">
            <apex:outputField value="{!c.Year__c}"/>
            </apex:column>
             
          <apex:column >
               <apex:facet name="header">
                    <apex:inputCheckbox onclick="chkselected(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!cus}" id="inputId"/>
                    </apex:column>       
        </apex:pageblockTable>
   </apex:pageBlockSectionItem>
<!-- </apex:outputpanel> -->
   </apex:pageblockSection> 
  
   <!-- section for internal needs-->
   
   
   <apex:pageblockSection title="Internal Needs" >
   <apex:pageBlockSectionItem dataStyle="width:100%" labelStyle="width:100%" >
   <apex:pageblockTable value="{!cus1}" var="c" styleclass="pageblock">
   
            <apex:column headerValue="Account" >
            <apex:outputField value="{!c.Account__c}" />
            </apex:column>
            <apex:column headerValue="Details">
            <apex:outputField value="{!c.Details__c}"/>
            </apex:column>
            <apex:column headerValue="Status">
            <apex:outputField value="{!c.Status__c}"/>
            </apex:column>
            <apex:column headerValue="Need">
            <apex:outputField value="{!c.Need__c}"/>
            </apex:column>
            <apex:column headerValue="Year">
            <apex:outputField value="{!c.Year__c}"/>
            </apex:column>
             
          <apex:column >
               <apex:facet name="header">
                    <apex:inputCheckbox onclick="chkselected(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!cus}" id="inputId"/>
                    </apex:column>       
        </apex:pageblockTable>
   </apex:pageBlockSectionItem>
   
   </apex:pageblockSection> 
  
   
   
  </apex:pageBlock>
  </apex:form>
</apex:page>
I'm new to salesforce, can you please tell me rough idea that how can I implement pagination?