Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

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 am using salesforce standard set controller and displaying 4 records a page,

I have input fields where i entering values and i wanted to save records on save button clicked.

I want to create a child record for each record.i.e i want update the four field instead the complete list,can i know to get the id's of the four records.

can know how can records values page wise.

share|improve this question
user6833, it's not entirely clear what you're trying to ask. Maybe adding more detail or including your code will help us help you. – Samuel De Rycke Mar 21 '14 at 14:13

Yes, you can get the ids of the records. In the constructor for your standardset extension, you can get the records using the following code:

public List<sObject> myRecords {get; private set;}

public MyClass(ApexPages.StandardSetController ctrl){
    myRecords = ctrl.getRecords();
    // - OR -
    myRecords = ctrl.getSelectedRecords();

    //To get the ids of those records, you could do something similar to:
    Set<Id> myRecordIds = (new Map<Id,sObject>(ctrl.getRecords())).keySet();

From there you can either make updates to myRecords, or use their Ids to generate children records based on those parents. Note, the getSelectedRecords is relevant if for instance you have a related list with checkboxes and a custom button (meaning the getSelectedRecords method will give you the records in that related list that are checked).

Hope that helps.

share|improve this answer

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.