0

I have custom object and which is a lookup to Quote.

1)I have created a "MassEdit" list button on the related list (Child object).

2) I am unable to retrieve the records (Child records) from the (Parent record) .

For Example :I have parent record say "pt1" and it has 2 child records in the related list say "ch1,ch2".Now when the user clicks on the "MASSEDIT" button on the related list ,it should open the records "ch1.ch2" to edit.After necessary changes the user will save the record.So how can i do this.I shall appreciate your help. Any suggestion plz.

Followed this Example : http://www.infallibletechie.com/2014/05/how-to-get-selected-records-from.html

VF CODE :

<apex:page StandardController="Compitetor__c" sidebar="false" recordSetVar="Compitetors"     extensions="CompitetorsEditExt">
 <apex:form >
  <apex:sectionHeader title="Edit for Competitor"/>
  <apex:pageBlock title="Quote Update"  mode="Edit">
   <apex:pageBlockButtons >
    <apex:commandButton action="{!SAVE}" value="SAVE"/>
    <apex:commandButton action="{!CANCEL}" value="CANCEL"/>
   </apex:pageBlockButtons>
    <apex:pageBlockTable value="{!selected}" var="com">
    <apex:column >
    <apex:inputField value="{!com.Name}"/>
    </apex:column>
 <apex:column >
   <apex:inputField value="{!com.Product_Series__c}" />
   </apex:column>
  </apex:pageBlockTable>
  </apex:pageBlock>
 </apex:form>
    </apex:page>

Apex Class :

public  class CompitetorsEditExt {

    public CompitetorsEditExt(ApexPages.StandardSetController controller) {
     controller.setPageSize(10);

    }
}
1
  • @KeithC:I have edited the question.Request you to have a look on it
    – nikkey
    Commented Dec 19, 2014 at 15:42

1 Answer 1

1

If you mean that you want to get the selected records in the controller then you can use the methods of the standard controller such as getSelected like this:

public  class CompitetorsEditExt {

    private ApexPages.StandardSetController sc;

    public CompitetorsEditExt(ApexPages.StandardSetController sc) {
        this.sc = sc;
        sc.setPageSize(10);
    }

    private Compitetor__c[] getSelected() {
        return (Compitetor__c[]) sc.getSelected();
    }

    private void someOtherMethod() {
        Compitetor__c[] competitors = getSelected();
        ...
    }
}
3
  • :i tried copying your code ,but it throws an Error :Method is not visible: [CompitetorsEditExt].getSelected() .Basically im looking for the available related records to get edit on One parent record .when the user clicks the Button created on related list.
    – nikkey
    Commented Dec 18, 2014 at 10:54
  • @nikkey I think you should edit your question to explain in more detail what you are looking to do.
    – Keith C
    Commented Dec 18, 2014 at 11:06
  • @nikkey: change private to public for the getSelected method. Commented Jul 3, 2015 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .