1

I am trying to fetch report list using wire.

import { LightningElement, wire, track, api} from 'lwc';
import REPORT_OBJECT  from '@salesforce/schema/Report';
import {getListUi} from 'lightning/uiListApi';
export default class cmpReportList extends LightningElement {
@wire(getListUi, {objectApiName: REPORT_OBJECT,listViewApiName: 'All'})
wiredlistView({error,data}) {
    if (data) {
        this.allreports = data.records;
    } else if (error) {
        this.error = error;
    }
}
}

But I am getting error while pushing the code No MODULE named markup://lightning:getListUi found. This might be because lightning:uiListApi is probably still in beta.

Is there any other way to fetch list without using apex method

1
  • Is it happening bcoz you are trying to access Reports? Did you check for other Objects?
    – Mohit K
    Commented Jan 31, 2020 at 10:32

2 Answers 2

2

According to the RecordUI API docs, Report is not in the supported object list, so you can't return the list. https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_get_started_supported_objects.htm

0

I think you forget to add this.allreports = data.records.records

and i am importing - import {getListUi} from 'lightning/uiListApi';

This code is working for me -

import {
    LightningElement,
    wire,
    track
} from 'lwc';
import {
    getListUi
} from 'lightning/uiListApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';

export default class ListUI extends LightningElement {
    @track sobjectResult;
    @wire(getListUi, {
        objectApiName: ACCOUNT_OBJECT,
        listViewApiName: 'All'
    })
    wiredlistView({
        error,
        data
    }) {
        if (data) {
            this.sobjectResult = data.records.records;
        } else if (error) {
            this.error = error;
        }
    }


}

Here is the Link for your Reference

Hope this will work for you, kindly let me know if you still find an error.

3
  • I made change but still does not work for me. Were you able to push this code using VS code? I am getting error mentioned in the question while pushing code to source org itself.
    – devforce
    Commented Jan 31, 2020 at 10:25
  • 1
    Note that uiListApi (official documentation here - I suggest always providing links to official documentation rather than third-party material where possible) is still in Beta.
    – Phil W
    Commented Jan 31, 2020 at 10:28
  • Yeah, It is still in beta. Even if it works in dev org, it cannot be deployed to PROD.
    – devforce
    Commented Jan 31, 2020 at 10:35

You must log in to answer this question.

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