function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SampathNamburiSampathNamburi 

Mass update of Case and Casecomment


Hi,
I would like to create a VF page where Case (Case number, Subject, Version ..etc) and CaseComment (comment body) details will be displayed for mass edit purpose. This is something like mass edit of multiple objects.

I could able to achieve the mass edit of single object which is for Case but i am not sure how i can display an empty text box for each case to enter case comments and up on clicking save button the system should update the case and insert a new case comment.

 

Below is the code where I am upto.

 

<apex:page standardController="Case" 
           recordSetVar="cases"
           tabStyle="Case" sidebar="false">
  <apex:form >
    <apex:pageBlock >
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Quick Save" 
                            action="{!quicksave}"/>
        <apex:commandButton value="Save" 
                            action="{!save}"/>
        <apex:commandButton value="Cancel" 
                            action="{!cancel}"/>
                            
      </apex:pageBlockButtons>
      <apex:panelGrid columns="4">
    <apex:commandLink action="{!first}"><b>First</b></apex:commandlink> 
    <apex:commandLink action="{!previous}"><b>Previous</b></apex:commandlink> 
    <apex:commandLink action="{!next}"><b>Next</b></apex:commandlink> 
    <apex:commandLink action="{!last}"><b>Last</b></apex:commandlink> 
   </apex:panelGrid>      
      <apex:pageBlockTable value="{!cases}" var="c">
        <apex:column value="{!c.casenumber}"/>
        <apex:column value="{!c.subject}"/>
        <apex:column headerValue="Upgrade Status">
         <apex:inputField value="{!c.Upgrade_Status__c}"/>
         </apex:column>
       <apex:column headerValue="SP Installed">
         <apex:inputField value="{!c.SP_Installed__c}"/>
         </apex:column>
        <apex:column value="{!c.SP_To_Install__c}"/>
        <apex:column headerValue="Status">
          <apex:inputField value="{!c.status}"/>
        </apex:column>
        <apex:column headerValue="Change Status to">
          <apex:inputField value="{!c.Next_Status__c}"/>
       </apex:column>
      </apex:pageBlockTable>
      <apex:panelGrid columns="4">
    <apex:commandLink action="{!first}"><b>First</b></apex:commandlink> 
    <apex:commandLink action="{!previous}"><b>Previous</b></apex:commandlink> 
    <apex:commandLink action="{!next}"><b>Next</b></apex:commandlink> 
    <apex:commandLink action="{!last}"><b>Last</b></apex:commandlink> 
   </apex:panelGrid>      
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

Shashikant SharmaShashikant Sharma

You need to use a wrapper class for it.

See this

http://wiki.developerforce.com/index.php/Wrapper_Class

 

Your wrapper should be like this

     public class caseWrapper
        {
		public Case caseItem {get; set;}
		public String caseComment {get; set;}

		public caseWrapper(Case c) 
                {
			caseItem = c;
			
		}
	}

 You can change your wrapper as per your need, i just gave an example.