I am trying to retrieve a single record field of an object with the following:

  import { LightningElement, api, track, wire} from 'lwc';
  import { getRecord } from 'lightning/uiRecordApi';` 

const fields = [


export default class CustomerSystemWebComponent extends LightningElement {
    @api recordId; 
    @track name;
    @wire (getRecord,{ recordId: '$recordId', fields })
loadSystems ({ error, data }) {
    if(error) {
        // TODO: handle error
    } else if (data) {
        //get customer systems
        this.name = data.fields.Name.value;
        this.sysId = data.fields.System_Id__c.value;

get systemId() {
    return (this.name) ? `${this.name} Customer System Name` : 'Name';

This code works for retrieving the name field it returns CS-01024 Customer System Name, but when I change it for


It does not display anything.

I tried this:

return ( (this.sysId)!==null ) ? `${this.sysId} Customer System Name` : `${this.name} Not Found`; 

and it returns undefined Customer System Name.

What am I missing here, should it not work the same way?

  • 1
    @wire (getRecord,{ recordId: '$recordId', fields }) should also be @wire (getRecord,{ recordId: '$recordId', fields: fields }).
    – sfdcfox
    Jul 3, 2019 at 22:28

2 Answers 2


Your property sysId is not declared, you should probably add it as a public or private property before trying to assign it a value as you are doing for the other properties.


@api recordId; 
@track name;
sysId; //Private property
  • 1
    ahh, yes. I missed it!
    – sforg1
    Jul 3, 2019 at 22:26
  • can I pass systemId as a query parameter? Like this: https://mysite/customer_system_api.php?token={token}&sys={systemId}&type=header
    – sforg1
    Jul 4, 2019 at 0:12

This wasn't the solution for your situation, but in my case, my problems was that I didn't mark the Apex class properties with @AuraEnabled. Ended up seeing the records populated in the Apex debug logs, but on alert, saw this...Empty objects on data array

You must log in to answer this question.

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