According to documentation, Lightning Data Services is built on top of UI API. So my question is: How I do to user Get Child Records UI API?

  • Nothing. I just created an Apex AuraEnabled method to return the records and wire up on the frontend with wire function – Saulo Jan 17 at 12:53
  • I was expecting to have something similar to import { getRecord } from 'lightning/uiRecordApi'; (with the name likely to getChildRecord) so bringing child records into component with something like @wire(getChildRecord, { recordId: '$recordId', fields }). – Saulo Jan 17 at 12:57

You should be able to do this using the getRecordUi wire adapter and specifying a childRelationships parameter:

import { LightningElement, wire } from 'lwc';
import { getRecordUi } from 'lightning/uiRecordApi';

export default class Example extends LightningElement {
  @wire(getRecordUi, { recordIds: '123', childRelationships: "Account.Opportunities" })

Note that layoutTypes and modes are still required

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.