Correction in your question:
here is the way to fetch reference/lookup records
You are not really fetching records. You are getting the definitions of fields through imports.
Problem:
It seems there are bugs for importing fields definitions for some fields/objects like in your case Case/Lead Owner Name. Also you cannot import the field definition for Geolocation fields - for example aLocation__longitude__s
and aLocation__latitude__s
Solution:
Until we get a fix from salesforce, You can directly use these fields like 'Case.Owner.Name'
in wire service as shown in below sample:
import CASE_SUBJECT_FIELD from '@salesforce/schema/Case.Subject';
import CASE_ACCOUNT_FIELD from '@salesforce/schema/Case.Account.Name';
import CASE_CONTACT_FIELD from '@salesforce/schema/Case.Contact.Name';
export default class Poc extends NavigationMixin(LightningElement) {
@api recordId;
@wire(getRecord, { recordId: '$recordId', fields: ['Case.Owner.Name', CASE_SUBJECT_FIELD, CASE_ACCOUNT_FIELD, CASE_CONTACT_FIELD] })
gAcc({ data, error }) {
console.log('Acc data => ', JSON.stringify(data), JSON.stringify(error), this.recordId);
}
}
Output:
{
"apiName": "Case",
"childRelationships": {
},
"fields": {
"Account": {
"displayValue": "Edge Communications",
"value": {
"apiName": "Account",
"childRelationships": {
},
"fields": {
"Name": {
"displayValue": null,
"value": "Edge Communications"
}
},
"id": "00128000009j45lAAA",
"lastModifiedById": "00528000001IIBvAAO",
"lastModifiedDate": "2015-11-16T09:57:33.000Z",
"recordTypeInfo": null,
"systemModstamp": "2017-12-11T18:45:20.000Z"
}
},
"Contact": {
"displayValue": "Rose Gonzalez",
"value": {
"apiName": "Contact",
"childRelationships": {
},
"fields": {
"Name": {
"displayValue": null,
"value": "Rose Gonzalez"
}
},
"id": "00328000008ZUISAA4",
"lastModifiedById": "00528000001IIBvAAO",
"lastModifiedDate": "2015-11-16T09:57:33.000Z",
"recordTypeInfo": null,
"systemModstamp": "2015-11-16T09:57:33.000Z"
}
},
"Owner": {
"displayValue": "Sasank VS",
"value": {
"apiName": "Name",
"childRelationships": {
},
"fields": {
"Name": {
"displayValue": null,
"value": "Sasank VS"
}
},
"id": "00528000001IIBvAAO",
"lastModifiedById": null,
"lastModifiedDate": null,
"recordTypeInfo": null,
"systemModstamp": null
}
},
"Subject": {
"displayValue": null,
"value": "Starting generator after electrical failure"
}
},
"id": "500280000068Gv5AAE",
"lastModifiedById": "00528000001IIBvAAO",
"lastModifiedDate": "2015-11-16T09:57:33.000Z",
"recordTypeInfo": null,
"systemModstamp": "2015-11-16T09:57:33.000Z"
}