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
Rinigrace MekalaRinigrace Mekala 

Fetching values between objects

Hi, 
    I have two objects 'A' & 'B' and a VF page. A field from object 'A' is a lookup in object 'B'. On selecting a lookup field of 'A', the values corresponding to that field have to be auto populated in my VF page. But it was not happening. 
Can anyone please explain why?

Note: VF page is of object 'B'. Iam using Lightning Experience.

Thanks in advance.
Miroslav SmukovMiroslav Smukov
Please share your code as well so we can see where the problem is. Thanks.
srlawr uksrlawr uk
If you have a visualforce page for object B, with a lookup field to object A, you can just use the relationship name to render the fields from it.. as simple as this:
 
<apex:page standardController="B__c">

    <apex:outputField value="{!B__c.Id}" />

    <apex:outputField value="{!B__c.A_lookup__r.Id}" />

</apex:page>

(so this renders the Id of object B first, and then the ID of object A, as it is found through the relationship field A_lookup__c on object B)

If something like this doesn't work then you have apparantly made something more complicated, but without the code/examples it is impossible to deduce! Hope this helps.