getListRecordsByName

Use this wire adapter to get record data for a list view.

See Get List View Records.

Parameter NameTypeDescriptionRequired?
objectApiNameStringThe API name of a supported object.Yes
listViewApiNameStringThe API name of a list view, such as AllAccounts.Yes
fieldsString[]Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, an error occurs.
optionalFieldsString[]Additional fields queried for the records returned. These fields don’t create visible columns. If the field isn’t available to the user, no error occurs and the field isn’t included in the records.
pageSizeIntegerThe number of list records viewed at one time. The default value is 50. Valid values are 1—2000.
searchTermStringA search term to filter the results. Wildcards are supported.
sortByStringThe API name of the field the list view is sorted by. If the name is preceded with -, the sort order is descending. For example, Name sorts by name in ascending order, and -CreatedDate sorts by the created date in descending order. This parameter accepts only one value per request.
whereStringThe filter applied to returned records, in GraphQL syntax. For example, { and: [ { StageName: { eq: "Prospecting" } }, { Account: { Name: { eq: "Dickenson plc" } } } ] } filters an Opportunity related list to show only opportunities in the Prospecting stage that are linked to the "Dickenson plc" account.
pageTokenIntegerA token that represents the page offset. To indicate where the page starts, use this value with the pageSize parameter. The maximum offset is 2000 and the default is 0.

Read the data that's returned by the wire adapter using a property or function.

propertyOrFunction—A private property or function that receives the stream of data from the wire service.

  • If a property is decorated with @wire, the results are returned to the property’s data property or error property.
  • If a function is decorated with @wire, the results are returned in an object with a data property and an error property.

This code example fetches list view records by API name then iterates through the list of records. The handleNextPage click handler returns the next set of record names.

The JavaScript code displays 10 records at one time. To handle pagination, use the pageToken with the pageSize parameter. Get the next set of record names by setting nextPageToken on pageToken. This value is incremented in steps of 10, as determined by the pageSize value.

Similarly, you can also handle backward pagination by using the previousPageToken property that's returned by the getListRecordsByName wire adapter. For more information, see List Record Collection.

See Also