function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Guru Dev 6Guru Dev 6 

while retrieving the child records ,i want to get the parent id ,and based on that id i want to retrieve the child records?

I have two custom objects, company and employees
company object is parent and employee is child ,
I have a custom button on company objects, i have list of 3 companies, when i click that custom botton it should give the list of emplyees under that parictaular company and also that records shuold be editable to save.
 
Guru Dev 6Guru Dev 6
Here is my code vf page:
<apex:page standardController="Employee__c"   extensions="CoachingFeedBackExt" recordSetVar="emp" tabStyle="Opportunity" sidebar="false">
  <apex:form >
    <apex:pageBlock title="All Employees Edit and Save Page">
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
                  <apex:commandButton value="Cancel" action="{!Cancel}"/>

      </apex:pageBlockButtons>
        
      <apex:pageBlockTable value="{!emp}"  var="opp"  >
       
          <apex:column value="{!opp.Name}"/>
          
        <apex:column headerValue="Email">
          <apex:inputField value="{!opp.Email__c}"/>
        </apex:column>
          
          <apex:column headerValue="Designation">
          <apex:inputField value="{!opp.Designation__c}"/>
        </apex:column>
       
           <apex:column headerValue="Working">
          <apex:inputField value="{!opp.Working__c}"/>
        </apex:column>
          
           <apex:column headerValue="Resigned">
          <apex:inputField value="{!opp.Resigned__c}"/>
        </apex:column>
          
          <apex:column headerValue="Reason">
          <apex:inputField value="{!opp.Reason__c}"/>
        </apex:column>
      </apex:pageBlockTable>      
    </apex:pageBlock>
  </apex:form>
</apex:page>




My apex classs:

public  class CoachingFeedBackExt 
{

    public Employee__c CoachingFeedBack {get;set;}

    

     public CoachingFeedBackExt(ApexPages.StandardController controller) 
    {
      CoachingFeedBack= (Employee__c )controller.getRecord();
    String  Id = System.currentPagereference().getParameters().get('id');
      CoachingFeedBack.Migarateid__c = Id;  

    }



}

Only using the vf page code , i got all total employes not a particalur company emplyoeee, so i tired to write a apex class, since i'm new to this vf page can anyone help me.