Newer Version Available

This content describes an older version of this product. View Latest

Try It Out: Create the Mass Update Status Page

We'll begin implementing the Mass Update Status feature by creating the Visualforce page that lets users choose the value with which the Status field is updated. To make this page even more usable, we'll include a table that shows the Job Application Number, Position Title, Candidate Name, and Status of each selected job application.
  1. In the address bar of your browser, replace everything to the right of salesforce.com/ with apex/MassUpdateStatus.
The resulting URL should look something like this: https://na1.salesforce.com/apex/MassUpdateStatus. Remember to only modify the part of the URL after salesforce.com/.
  1. Press Enter.
  2. Click the Create Page MassUpdateStatus link.
We now have a new Visualforce page called MassUpdateStatus. Next, we'll add the Visualforce markup that implements the Mass Update Status functionality.
To enter our markup, we'll use the Visualforce development mode page editor just as we did before. But this time around, we won't need any JavaScript; Visualforce will be able to do it all!
  1. In the footer at the bottom of the MassUpdateStatus Visualforce page, click MassUpdateStatus to display the Visualforce development mode page editor.
  2. Delete all of the default markup in the Visualforce development mode page editor and replace it with the following markup. Remember that instead of typing, it's easiest to copy and paste the code from the MassUpdateStatusSample file located in the RecruitingApp-7_0.zip file you downloaded from developer.force.com/books/fundamentals.
    1<apex:page standardController="Job_Application__c"
    2    recordSetVar="applications">
    3  <apex:sectionHeader title="Mass Update the Status
    4      of Job Applications"/>
    5  <apex:form>
    6    <apex:pageBlock>
    7      <apex:pageMessages />
    8      <apex:pageBlockButtons>
    9        <apex:commandButton value="Save"
    10            action="{!save}"/>
    11        <apex:commandButton value="Cancel"
    12            action="{!cancel}"/>
    13      </apex:pageBlockButtons>
    14      <apex:pageBlockSection title="Status Update"
    15          collapsible="false">
    16        <apex:inputField value=
    17            "{!Job_Application__c.Status__c}"/>
    18      </apex:pageBlockSection>
    19      <apex:pageBlockSection title="Selected Job
    20          Applications" columns="1">
    21        <apex:pageBlockTable value="{!selected}"
    22            var="application">
    23          <apex:column value="{!application.name}"/>
    24          <apex:column value=
    25              "{!application.position__r.name}"/>
    26          <apex:column headerValue="Candidate Name">
    27            <apex:outputText value=
    28                "{!application.candidate__r.
    29                First_Name__c & ' ' & application.
    30                candidate__r.Last_Name__c}"/>
    31          </apex:column>
    32          <apex:column value=
    33              "{!application.Status__c}"/>
    34        </apex:pageBlockTable>
    35      </apex:pageBlockSection>
    36    </apex:pageBlock>
    37  </apex:form>
    38</apex:page>

    In this sample code, notice that some components don't have close tags. If there are no other components nested within a component, you can “close” the tag by putting a forward slash at the end of the start tag, like: <apex:sectionHeader/>.

    Tip

  3. Click Save button.