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 })
  • 1
    can you add markup? Jun 21, 2019 at 11:44
  • FWIW, I just found that wiring the Contact.MailingAddress (compound address field) made the entire wired Contact object come back as either undefined (when wiring to function) or an empty object (when wiring to property). Removing that wired field made the wiring function as expected. Not sure on support for complex field types like Mailing Address... Jan 22, 2020 at 19:15

1 Answer 1


The wire service first provisions the shape of the value: { data: undefined, error: undefined }. This enables wiring of properties and their direct use in the template to test for data and error. Eg <template if:true={wiredProperty.data}>.

This is why you see said value provided to your wired function.

As for why it's not being invoked a second time with the data or error, I recommend checking the values of this.clientId and this.accountFields. Are either undefined? Per https://developer.salesforce.com/docs/component-library/documentation/lwc/data_wire_service_about, Properties in the adapterConfig object can’t be undefined. If a property is undefined, the wire service doesn’t provision data. Try setting a breakpoint (eg with debugger) in connectedCallback() and inspecting the values.

You must log in to answer this question.

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