0

I was digging through the Component Library and was trying to identify any interfaces that would allow us to retrieve information from a parent reference. For example, on a case detail page, we use a force:hasRecordId to get the case Id and related fields - could we use that or another interface to get fields from a parent reference? We want to obtain a single value from a parent reference and use it in our component.

Everything I'm seeing is pointing to performing a query server side with an apex controller - which is doable, just feels excessive based on my limited lightning experience.

Follow up, based on what I've found on my research, it sounds like an apex controller is best practice. Are there any guides or advice on choosing client-side vs server-side?

1 Answer 1

1

There are various to pull information in your component. If you are looking for Lightning web Component, You would consider these:-

  1. Lightning Data Service You can just pass the recordId and get all the field values using base components like lightning-record-edit-form, lightning-record-form, and lightning-record-view-form components.
  2. Wire Service It allows you to access data in client-side. Example in github repo here:- LWC Recipe

Invoking Apex method in server-side comes when any of the above approaches does not work for you.

1
  • Thank you, that helps and the repo is a good example. I just stumbled across this and found it helpful as well.
    – zainogj
    Apr 21, 2020 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .