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
Tyler Brooks 16Tyler Brooks 16 

Lightning Component on a custom object to show Contacts related to the M-D account

Hello all,
I am sure this has been asked/answered but I am having a heck of a time finding an applicable post so here it goes.
I have several custom objects that have the 'Account' as a lookup or master object. I would liek to create a Lightning COmponent on the App pages for these objects that will show me a list of the contacts related to that account. Ideally it would be one component that could be used on multiple objects, but if I need one for each custom object that is fine.  Any and all assistance is very appreciated!
Cheers all and happy weekend!
Danish HodaDanish Hoda
hi Tyler,
All you need is to query on doInit() method of the lightning component for the parent Account and fetch the related Contacts and display in a table.

And add the lightning cmp on the record page from Lightning App builder, you can also have this generic, by using schema of the object without much efforts.
Tyler Brooks 16Tyler Brooks 16
Danish, thank you for the response. Do you have a link to somewhere that explains this more in depth? I am very new to development and LWC.

Thanks!