Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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 at 14:13
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.