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.

  • 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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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