nerdexam
Salesforce

PDI · Question #199

Universal Containers has a Visualforce page that displays a table of every Container__c being rented by a given Account. Recently this page is failing with a view state limit because some of the…

The correct answer is B. Implement pagination with a StandardSetController. To resolve a Visualforce view state limit error caused by displaying over 10,000 records, the developer should implement pagination using a StandardSetController.

Submitted by daniela_cl· Apr 18, 2026User Interface

Question

Universal Containers has a Visualforce page that displays a table of every Container__c being rented by a given Account. Recently this page is failing with a view state limit because some of the customers rent over 10,000 containers. What should a developer change about the Visualforce page to help with the page load errors?

Options

  • AUse JavaScript remotlng with SOQL Offset.
  • BImplement pagination with a StandardSetController.
  • CImplement pagination with an OffaetController.
  • DUse lazy loading and a transient List variable.

How the community answered

(36 responses)
  • A
    3% (1)
  • B
    94% (34)
  • C
    3% (1)

Why each option

To resolve a Visualforce view state limit error caused by displaying over 10,000 records, the developer should implement pagination using a `StandardSetController`.

AUse JavaScript remotlng with SOQL Offset.

While JavaScript remoting can fetch data asynchronously, using SOQL `OFFSET` for pagination with very large data sets (like 10,000+ records) is generally inefficient and can lead to performance degradation as the offset increases.

BImplement pagination with a StandardSetController.Correct

Implementing pagination with a `StandardSetController` is the most effective and recommended solution for handling large data sets on Visualforce pages. This controller automatically limits the number of records displayed per page, significantly reducing the view state size and improving page performance by only fetching a subset of records at a time.

CImplement pagination with an OffaetController.

`OffsetController` is not a standard Salesforce class or pattern available for Visualforce pagination; `StandardSetController` is the correct class for this purpose.

DUse lazy loading and a transient List variable.

Using the `transient` keyword for a list variable can reduce view state by preventing its serialization, but it does not address the fundamental problem of initially querying and processing an excessively large number of records from the database, which pagination handles.

Concept tested: Visualforce pagination with StandardSetController

Source: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_pagination.htm

Topics

#Visualforce#View State#StandardSetController#Pagination

Community Discussion

No community discussion yet for this question.

Full PDI Practice