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
Troy PlainTroy Plain 

Bulk close cases from list view

Hi all,

I'm currently trying find a way of closing off multiple cases while working from the List View. The 'Close' button does not suit my needs as it leads to the CaseMassAction page which only has 3 unsuitable options (we have several mandatory fields that need filling before a case can be closed) and is currently uneditable. So I had the idea to create a custom button that leads to a Visualforce page that would have the required fields. This is the VF page that I created for the task:
 
<apex:page standardController="Case">
  <apex:form >
    <apex:pageBlock title="Close Cases">
      <apex:pageBlockButtons >
        <apex:commandButton action="{!Save}" value="Save"/>
        <apex:commandButton action="{!Cancel}" value="Cancel"/>
        </apex:pageBlockButtons>
          <apex:pageBlockSection collapsible="false" title="Case Information" >
            <apex:inputField value="{!Case.Status}"/>
            <apex:inputField value="{!Case.Reason}"/>
            <apex:inputField value="{!Case.Fault_type__c}"/>
            <apex:inputField value="{!Case.Resolution_code__c}"/>
            <apex:inputField value="{!Case.Closure_Code__c}"/>
            <apex:inputField value="{!Case.Bridge_Case_Closure_Notes__c}"/>
            <apex:inputField value="{!Case.Send_Resolved_Email__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Which produces this page, which is perfect for our needs:
User-added image
However, something has gone wrong somewhere. If I go to a list view, select multiple cases via the tick boxes and click my custom button I get taken to the VF page as expected. However, once I change the status to Closed, make all the relevant field changes and click Save I am taken to a brand new Salesforce case that has been opened and closed immediately. Checking back on the list view all of the cases that I ticked are still open.

I'm assuming that I've missed something that tells the VF page to collect the case reference from the list view in order to edit them accordingly, however I've got no idea what I would need to change to make that happen (or if, in fact, that is even possible). Any and all help would be very much appreciated!
 
Troy PlainTroy Plain
I've just realised that my customer button only open the VF page, using the Java below:
 
window.location = 'apex/Bulk_Close';

Which is very likely what the issue is. So, new question: how do I make the custom button act like it and perform a CaseMassAction using the VF page I've created?