
I have created a custom button ,on the custom object
label & Name as "EDIT ALL"
Type :ListButton
behaviour as :Execute JavaScript
Content Source:onclick javascript
given an url as:parent.window.location.replace("/apex/Compitetor?id={!Compitetor__c.Id}");
Now what im facing is when i click on the custom button it should show only the related records to particular parent record,but i get all the records displayed of the child object(i.e custom object).Any suggestion plz.
when i click on the "EDIT All" button ,it should give me an option to edit the child records related to the parent record.For eg:if i have one parent record (quote)and 4 child records (custom) out of which 3 are related to the parent record.now when i click on the edit all button ,it should be give an option to edit those 3 related child record and save.
VF Code :
<apex:page controller="CompitetorController" sidebar="false" > <apex:form > <apex:sectionHeader title="Edit Compitetors for" /> <apex:pageBlock title="General Information" mode="inlineEdit"> <!--<apex:pageMessages /> ---> <!-- Display Save and Cancel Button --> <apex:pageBlockButtons > <!--<apex:commandButton action="{!edit}" id="editButton" value="Edit"/> --> <apex:commandButton value="SAVE" action="{!SAVE}" id="SaveButton" /> <apex:commandButton value="CANCEL" action="{!CANCEL}" onclick="resetInlineEdit()" id="CancelButton"/> </apex:pageBlockButtons> <!-- A PageBlockSection for Entry and Display Customer Values --> <apex:pageBlockSection columns="5"> <apex:outputField value="{!com.Part_Number__c}" label="PartNumber"/> <apex:outputField value="{!com.Price_Offered__c}" label="Price"> <apex:inlineEditSupport showOnEdit="saveButton ,cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!com.Volume__c}" label="Volume"/> <apex:outputField value="{!com.Date_Price_is_valid__c}" label="Date Price is valid"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Apex Class :
public with sharing class CompitetorController { public Compitetor__c com {get;set;} public String CompitetorId{get;set;} public String message{get;set;} /** *@purpose : Constructor to fetch current Customer Record and its Action **/ public CompitetorController () { CompitetorId = System.currentPageReference().getParameters().get ('Id'); if(CompitetorId != NULL){ Com = [SELECT Id,Name,Product_Series__c, Part_Number__c, Price_Offered__c , Volume__c, Date_Price_is_valid__c FROM Compitetor__c WHERE id=:CompitetorId]; } } /** *@purpose : Method for Saving the Customer Object Record *@param : None *@return : PageReference to Standard Salesforce Record Detail Page **/ public PageReference SAVE() { try{ upsert com; PageReference nextpage= new PageReference('/'+com.id); return nextpage; } catch(Exception e){ //message='Data Base error during saving...'; //ApexPages.addMessage( new ApexPages.Message //(ApexPages.Severity.ERROR, message)); return null; } } public PageReference CANCEL() { return null; } }Thanks in Advance