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 '19 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 '19 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

  • 3
    This seems to be one of the biggest myths about this feature! childRelationships is not an attribute of getRecordUi! I don't know why everybody is referencing it from each other! Copy pasting it from others does not make it true. It does actually not have any effect on the result of getRecordUi. – Basti Sep 4 '19 at 17:45
  • Agree... Important feature missing here – Lucas Ennouchi Sep 22 '19 at 11:20

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.