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
Chandra babu 2Chandra babu 2 

How to Display the values on lookup relation on vf page

Item Code search:                                                              
 
  Item Name
   Item Price  
   Item Quantity

Transaction ID        :::this are the purchase fields
Transaction Date 
Amount 
Discount 
Purchase Quantity 


i Have Taken Two Objects Stock And Purchase and Created the above Fields ,in the Stock i was Given Item code ,Then Automaticallly Display the Purchase values also.pls tel me How to give the lookup and Display the values on vf [page.
Best Answer chosen by Chandra babu 2
Ajay K DubediAjay K Dubedi
Hi Chandra,

Description of your problem is quite confusing but what i got from your question is you want to have lookup from One object to other 
You can achieve by making custom lookup field to the object you want to make.
Secondly To make visible the field values on VF page of purchase object you have to create the formula field to get the value of the particular field of Purchase object you want.
In the Formula field you wil use the formula like 

lookupfieldApiName__r.Amount__c. to get the amount for the particular item in the Purchase object

On a VF page you can use this formula field api name in 
<apex:outputfield value={!objectApiName.Formula Field Api name}/>

Thanks.