ForceChallenges
ProblemsDailyNotesInterview
Sign in

Practice

All problemsSOQL practiceApex trigger challengesDaily challengeOpportunityTrigger.oldMapBefore UpdateBulkificationContactValidationGROUP BYSemi-JoinAccountBefore Insert

Interview questions

All questionsAdminAdministrationApexApex TriggerAsync ApexDevelopmentField ServiceField ServiceIntegrationLwc

By company

DeloitteSalesforceAccentureInfosysPwCCognizant

Learn

Study notes

ForceChallenges

AboutContact usPrivacy PolicyTerms of ServiceFor AI assistants (llms.txt)
© 2026 ForceChallenges · Salesforce SOQL & Apex trigger practice
LWC questions2 of 50
LWCMedium 2 min read

How can developers utilize lightning/uiListApi to fetch and display standard list view data?

Answer

Basics: List views already encode filters, columns and sort order. Instead of re-implementing them in SOQL, you can read them: getListInfoByName({ objectApiName, listViewApiName }) returns metadata (display columns, filter info), and getListRecordsByName or getListUi return the records. Use it for components that show "my open cases" exactly as a list view does.

How it works: Wire the adapter with objectApiName and listViewApiName (or listViewId) plus options such as pageSize (default 50), sortBy (field names, - prefix for descending), fields/optionalFields (for getListRecordsByName) and pageToken. Results contain records.records[i].fields.Name.value; nextPageToken is used for paging. Because the structure is nested, flatten rows before binding to lightning-datatable.

Advanced / deep dive: getListUi returns both metadata and records, and is the older adapter; the newer pair getListInfoByName plus getListRecordsByName separates concerns and allows requesting extra fields (verify which are preferred in the current docs, as older adapters may be marked for replacement). Results respect the user's sharing, FLS and the list view's visibility, so different users see different rows. Use lightning/uiObjectInfoApi getObjectInfo for column labels and types. Paging uses tokens, not offsets, so you cannot jump to arbitrary pages. For complex joins, aggregates or beyond 2,000 rows per page, use Apex SOQL. List views using unsupported filters (for example some cross-object filters) or objects not supported by UI API will not load. The data is cached by LDS, so refresh after DML with the notify APIs.

Practice SOQL & Apex
PreviousHow do you create custom modal dialog windows in LWC using LightningModal?Next How do you subscribe to Platform Events and streaming channels in LWC using lightning/empApi?

More LWC questions

  • How can developers navigate to object home views and record creation pages using NavigationMixin?
  • How does the LWC reactivity engine manage property observation and virtual DOM updates?
  • What are the top performance optimization best practices for enterprise-grade LWC applications?
  • How do you perform imperative CRUD operations on records using lightning/uiRecordApi functions?
  • How do target configurations and design attributes work in the component's .js-meta.xml file?

Code / config example:

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

export default class ListViewTable extends LightningElement {
    rows = [];
    columns = [{ label: 'Name', fieldName: 'Name' }, { label: 'Industry', fieldName: 'Industry' }];

    @wire(getListUi, { objectApiName: ACCOUNT, listViewApiName: 'AllAccounts', pageSize: 25 })
    wired({ data, error }) {
        if (data) {
            this.rows = data.records.records.map(r => ({
                Id: r.id,
                Name: r.fields.Name.value,
                Industry: r.fields.Industry.value
            }));
        }
    }
}

Hidden gotchas & must-remember points:

  • Record data is nested under fields.<Field>.value; flatten for datatables.
  • listViewApiName is the list view's API name, not its label.
  • Paging is token-based.
  • Results depend on the current user's sharing and list view access.
  • Some list views and objects are not supported by UI API.
  • Fields shown depend on the list view's columns unless you request more.

Best practice: Use it when you must mirror an existing list view, and use Apex when you need custom queries or aggregates.

LWCuiListApiList Views