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
Nevin O'Regan 3Nevin O'Regan 3 

Component That Displays Information Related To A Lookup Field

I have a lookup field in the Contact record which looks up to a custom object Application__c. How can I show fields in a component related to the Application record? Is there a standard way of doing this?
Best Answer chosen by Nevin O'Regan 3
Nevin O'Regan 3Nevin O'Regan 3
Hi Codengine, 

I was able to achieve this by creating an Action of type 'Update Record' on the Application and then add the 'Related Record' standard component to the Contact page. 

All Answers

Naveen KNNaveen KN
Hi Nevin, I think you need to customize your code to achieve this.

In the lightning component you need to get the ID of the contact record > pass it to the client side controller > invoke apex code to get the application__c object details > pass back to the client side controller > display in the component as per your need.

Another approach is using Lightning Data Service which gives advantage of not implementing query functionality. passing recordId will get you the field values on the UI. 

 
Nevin O'Regan 3Nevin O'Regan 3
Hi Codengine, 

I was able to achieve this by creating an Action of type 'Update Record' on the Application and then add the 'Related Record' standard component to the Contact page. 
This was selected as the best answer