I can't get fields values with getRecord adapter. Component shows passed recordId only.

Where is the problem?

enter image description here

Parent HTML:

    <lightning-card title="My Trips">
        Parent component begins here:<br />
        <template if:true={trips.data}>
            Total trips  - {trips.data.length}
            <template for:each={trips.data} for:item="trip">
                <div key={trip.Id}>
                    <c-trip-list-item recordid={trip.Id}></c-trip-list-item>

Parent JS:

import getTrips from '@salesforce/apex/tripController.getTrips';
export default class TripList extends LightningElement {
      @wire(getTrips) trips;

Child HTML:

    Child component begins here:<br />
    {recordid} {record.data} {record.error}
    <template if:true={record.data}>
        - {name} - {status}

Child JS:

import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
const FIELDS = [

export default class TripListItem extends LightningElement {

    @api recordid;
    @wire(getRecord, { recordId: '$recordid', fields: FIELDS })

    get recorddata() {
        return this.record.data;
    get name() {
        return this.record.fields.Name.value;

    get status() {
        return this.record.fields.Trip_Status__c.value;

    get code() {
     return this.record.fields.Trip_TripCode__c.value;
  • I suggest you answer your own question to explain that the various paths in the get methods were missing the ".data" after ".record". – Phil W Jul 10 '19 at 19:36

The reason was:

get code() {
     return this.record **.data**. fields.Trip_TripCode__c.value;

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.