I query opportunity records using list view developer name, which is used for getListUi. But sometimes, randomly, when I go to the records page, I get this error:

enter image description here

Here's the wire for getListUi:

@api objectName;
secondaryFields = ['LastViewedDate', 'LastReferencedDate']
selectedListView = '';

@wire(getListUi, {
    objectApiName: '$objectName',
    listViewApiName: '$selectedListView',
    optionalFields: '$secondaryFields'
})wiredRecords(result) {
    this.wiredResult = result
    if (result.data) {
    } else if (result.error) {
        this.error = result.error
        this.records = undefined

How can I fix this error?

  • How are you using this component. From what I see in these snippets, the selectedListView attribute is empty and it's actually required for this wire adapter.
    – adriancg
    Commented Nov 19, 2020 at 14:33
  • Of course, it is used, otherwise, I would get the error all the time. Commented Nov 19, 2020 at 15:13
  • Well we can only try to help with the context that is provided in the question. I suggest you provide a little more context and a little less snark.
    – adriancg
    Commented Nov 19, 2020 at 15:33
  • In the documentation, developer.salesforce.com/docs/component-library/documentation/…, I dont see optionalFields as parameter for getListUi. May be because of that? Commented Nov 20, 2020 at 1:24


You must log in to answer this question.

Browse other questions tagged .