I am trying to do pagination for OrderItems using StandardSetController, however, when I am passing my query in setCon, I am getting following error.

List controllers are not supported for OrderItem.

Here is the code:

public ApexPages.StandardSetController setCon {
    if(setCon == null){
      size = 10;

      string queryString = 'select Id from OrderItem';
      setCon = new ApexPages.StandardSetController (Database.getQueryLocator(queryString));
      noOfRecords = setCon.getResultSize();
    return setCon;

public void getOrderItems(){
  List<OrderItem> lstOrderItem = new List<OrderItem>();
  for(OrderItem o : (List<OrderItem>)setCon.getRecords())
  return lstOrderItem;

1 Answer 1


I'm guessing this is down to some of the bespoke funcitonality inculded in order items around saving and discount calculations etc..

I think you're going to have to implement pagination manually, you could either query everything and do paging, or use the SOQL OFFSET keyword to pull different pages of data from the DB.

One other alternative is to send all items through to the page and do it through a jQuery plugin or similar, though you'd want to be sure you're not sending hundreds of records back and forth for performance reasons (this does seem unlikely but it'll depend on the business).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .