Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a simple table for displaying users...

<apex:page standardController="User" recordSetVar="Users" tabStyle="User">
  <apex:pageBlock >
  <apex:pageBlockSection title="Today’s usersRecords"> 
  <apex:form >
  <apex:pageBlockTable value="{!Users}" var="user" styleClass="list">
  <apex:column >
  <apex:facet name="header">Name</apex:facet>
  <apex:outputText value="{!user.Name}" />
   <apex:column >
  <apex:facet name="header">Push Email</apex:facet>
  <apex:inputCheckbox value="{!user.DM_APP_EMAIL__My_custom_field__c }" />
  <apex:pageBlock >
  <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>

It only displays 25 users. How do I display more users?

Note: I want to keep things simple. No controller if possible.

share|improve this question
up vote 6 down vote accepted

I'm afraid we don't have a good news for you ;)

By default, a list controller returns 20 records on the page. To control the number of records displayed on each page, use a controller extension to set the pageSize.

So you either display the previous / next controls or there's a setPageSize() method on StandardSetController...

share|improve this answer

I'm taking a look at what you're trying to do, and I think you might want to reconsider.

You have a list of records, you display a custom checkbox field, and then you want to save the changes.

This will work, but there something is going to happen that you may not be aware of. When you click the save button, you will be saving every record in the list. So if you have a list of 50 users, and you check just one of the boxes, all 50 users will have their last modified fields updated. In a way, it spoils your audit of what has actually changed in your user records. For some companies, this can create a compliance problem. You're also forcing the platform to do a lot more work than it needs to (updating 50 instead of 1).

I know you state you don't want a controller, but for this reason, I would suggest you at least consider using one. For mass edits like this, there is a tried-and-true pattern called a Wrapper Class. It allows you to select only the records you want to change for update. Your code then sifts through the selected records, and if only 3 need to change, then only three will change.

It does increase the complexity of your page, but I would suggest that in most instances it is worth it, and it is definitely a best practice.

share|improve this answer
I am just setting up test data and want it done quickly. Thanks for you concerns. – dublintech Jan 31 '13 at 11:53
In that case, quick and dirty gets the job done. :-) – Peter Jan 31 '13 at 12:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.