0

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?

closed as off-topic by Eric, Santanu Boral, Himanshu, Ratan Paul, Martin Lezer May 10 '17 at 7:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Eric, Santanu Boral, Himanshu, Ratan Paul, Martin Lezer
If this question can be reworded to fit the rules in the help center, please edit the question.

1

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...
allRecords.addAll(newRecords);
stdCtrl = new ApexPages.StandardController(allRecords);

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