• sachith s
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi, 
 
 I created a visual force page using below code. 

<apex:page title="Renewal Quote" controller="Renwal_Account_Contract" showHeader="false" sidebar="false" readOnly="true" cache="false">
<apex:form >
<apex:pageblock Title="Contract Based" rendered="{!ShowContractSection}"> 
  <apex:pageblockTable value="{!Asset_yourObjList }" var="Asset_obj">
  <apex:column headerValue="Check">
     <apex:inputCheckbox value="{!Asset_obj.Id}"/>
   </apex:column>  
    <apex:column value="{!Asset_obj.AccountId}"/>
    <apex:column value="{!Asset_obj.Product2Id}"/>
    <apex:column value="{!Asset_obj.SerialNumber}"/>
    <apex:column value="{!Asset_obj.last_contract_number__c}"/>
    <apex:column value="{!Asset_obj.Service_Start_Date_Min__c}"/>
    <apex:column value="{!Asset_obj.Service_End_Date_Max__c   }"/>
  </apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>

For above visualforce page below is the code for controller.

public with sharing class Renwal_Account_Contract
{
   Id conId = ApexPages.currentPage().getParameters().get('Id');
    
  public Renwal_Account_Contract()
  { 
   GetAccount = new Asset();    //Get Account Id from Page
   GetContract = new Asset();   //Get Contract Name from Page
   total_size = [select count() from Asset ];  
   Filter_Asset_Records();  
   
  }
 
  public Asset GetAccount{get;set;}
  public Asset GetContract{get;set;}
   
  public List<Asset> Account_yourObjList{get;set;}
  public List<Asset> Asset_yourObjList{get;set;}  
  public List<Asset> Default_Asset_yourObjList{get;set;}

 
  //Function to Return Asset Report Passing Contract Name
  public void Filter_Asset_Records(){ 
     
    Asset_yourObjList = new List<Asset>();
    Asset_yourObjList = [SELECT Id,AccountId,Product2Id,SerialNumber,last_contract_number__c,Service_Start_Date_Min__c, Service_End_Date_Max__c                      
                         FROM Asset
                         WHERE                                                
                         last_contract_number__c = :C.Name
                        // last_contract_number__c =:GetContract.Name 
                         Limit 10];                      
    }  
  
}

Page looks as mentioned below

User-added image


My Requirement is I need to store the data tat is displayed on datatable. I must store only the records that are selected from using checkbox. 

I need to store to Tem_Contract__C is the object which has all the fields as displayed on screen. Please suggest me how to store data 

Thanks
Sudhir