I am unable to get data using getRecord
method if wired to a function. The same call work when it is wired to property. I have given the code below. When wired to function, error
and data
(in wiredAccount
function) are coming back as undefined.
Wired to method (not working)
@wire(getRecord, { recordId: '$clientId', fields: accountFields })
wiredAccount({ error, data }) {
console.log('in wiredAccount');
if (data) {
this.account = data;
this.error = undefined;
} else if (error) {
this.error = error;
this.account = undefined;
}
}
Wired to property (working)
@wire(getRecord, { recordId: '$clientId', fields:accountFields })
account;