2

I have an LWC component that utilises getRecord from the lightning/uiRecordApi module. It requests fields from a custom object record.

import { LightningElement, api, wire, track } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import ENDED_FIELD from '@salesforce/schema/Interaction__c.Ended__c';

export default class WrapupActions extends LightningElement {

    @api recordId;
    @track ended;

    @wire (getRecord, {
        recordId : '$recordId',
        fields: [
            ENDED_FIELD,
        ],
    })
    getInteraction(res) {
        this.wiredResponse = res;
        const { data } = res;
        if (data) {
            this.ended = data.fields[ENDED_FIELD.fieldApiName].value;
        }
    }

    // ...
}

When refreshApex is called from somewhere else in the application (usually when the record has changed), the LWC component refreshes and around 50% of the time the getRecord call fails with the following error:

No such column 'MyNamespace__Ended__c' on entity 'MyNamespace__Interaction__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

I know the field name is correct because:

  1. The getRecord call works half the time on refreshApex and everytime on page load
  2. The field name is imported using the schema @salesforce/schema/Interaction__c.Ended__c

Can anyone shed some light on why this might be happening? The intermittent nature of the issue is proving frustrating to debug.

1
  • I have exactly the same issue. Happened today.
    – rmatusiak
    Commented Oct 7, 2019 at 10:50

1 Answer 1

2

This maybe due to a permissions issue in Sales-force.

  1. Look at the entity and column name displayed in the error message.
  2. Navigate to the specific field mentioned in the Sales-force Setup menu.
  3. Click the Set Field-Level Security button.
  4. Make sure it has read access or above.
2
  • Thanks for the response. Unfortunately this isn't the issue as the getRecord call does work on page reloads and often works on refreshApex. It's the seemingly random nature of the error occurance that's bugging me. Commented Oct 8, 2019 at 19:45
  • 1
    I was lead here by the INVALID_FIELD error message and this solved it for me, thank you!
    – itsmebasti
    Commented Dec 19, 2020 at 2:36

You must log in to answer this question.

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