I have an extension for a custom child object. I need to build a list of all child records + create new child records for the parent that does not yet have a child record... and then paginate over that list, before inserting records.

Any ideas how to do this? Is it possible?


Generally speaking, you'll have to use the alternative StandardSetController syntax, namely the one that accepts a list:

// clone to clear the list read-only attribute
SObject[] allRecords = [SELECT Id... FROM Child].clone(), 
          newRecords = new SObject[0];
// Add records to newRecords, then...
stdCtrl = new ApexPages.StandardController(allRecords);

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