Suppose I have two objects Account and Call in Salesforce. Now I want to display the latest Call Id in the Account object in a particular field of Account. Suppose the field name on Account is 'Related Call'. And also when we click on the latest Call Id field in Account, we will see the detail Call page. How this is done by writing a Visualforce page?
0
votes
1 Answers
1
votes
Since in your scenario the field is a relationship between two Salesforce records, you can achieve this using built-in Salesforce functionality without a Visualforce page.
Create a custom field 'RelatedCall' on Account of type Lookup and choose the Call object as the Related object.
Then add the 'RelatedCall' to the Account page layout, and if you open an Account page and click it, it will bring you to the detail page of the Call.
If you want to do this in a Visualforce page you can use apex:outputLink.
<apex:page standardController="Account">
<apex:outputLink value="/{!account.RelatedCall__c}" target="_parent">Related Call</apex:outputLink>
</apex:page>