+ Start a Discussion
Nagarjuna Reddy.PNagarjuna Reddy.P 

auto populate on lookup selection in visual force page

Hello EveryOne,
                           I have two objects Standard(Child) and custom object (Parent) i want to create a visual force page that includes fields from both parent and child objects , Now when i select Look up field Name (ex:parent record) as some abc in vf page the details(other fields) of abc record is to be auto populated in the vf page (i am trying to create Vf Page on Child object) , i need this functionality either in lightning experience(using lightning components) or Visual force page  ,please help me.
Thank you Every One.

sachin kadian 5sachin kadian 5
Hey,

if you are using lightning component, you can use onchange="!c.functionName" or same thing in VF also  on lookup field selection.

called function will have logic to query the child details and  render them on lightninig component or vf page
 
Nagarjuna Reddy.PNagarjuna Reddy.P
Hii Sachin, 
        if you have any code(lightning component ) similar to my requirement  please post me.
Thank you. 
sachin kadian 5sachin kadian 5
You can use force input field to render lookup.
 
<force:inputField aura:id="accLookup" value="{!v.account.LookupField__c}" />
on change of lookup , you can can call lightning controller method using this.
 
<aura:handler name="change" value="{!v.account.LookupField__c}" action="{!c.queryChildern}"/>
 
queryChildern : function(component,event,helper){
    // write logic here to fetch details from backend 
   //call apex class method here
}

I dont have any sample code right now but hope this logic can help you..
 
Nagarjuna Reddy.PNagarjuna Reddy.P
Hey ,
               Thats great, I will try on this.
         Thank you  once again.
sachin kadian 5sachin kadian 5
Glad to help you.

Please mark it complete so that it can help others.