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);

    }
}
  • @KeithC:I have edited the question.Request you to have a look on it – nikkey Dec 19 '14 at 15:42
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();
        ...
    }
}
  • :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 Dec 18 '14 at 10:54
  • @nikkey I think you should edit your question to explain in more detail what you are looking to do. – Keith C Dec 18 '14 at 11:06
  • @nikkey: change private to public for the getSelected method. – MayTheSForceBeWithYou Jul 3 '15 at 20:20

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.