getListRecordsByName
Use this wire adapter to get record data for a list view.
objectApiName
–(Required) The API name of a supported object.listViewApiName
–(Required) The API name of a list view, such asAllAccounts
.fields
–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.optionalFields
–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.pageSize
–The number of list records viewed at one time. The default value is 50. Valid values are 1—2000.searchTerm
–A search term to filter the results. Wildcards are supported.sortBy
–The 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.where
–The 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.pageToken
–A token that represents the page offset. To indicate where the page starts, use this value with thepageSize
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’sdata
property orerror
property. - If a function is decorated with
@wire
, the results are returned in an object with adata
property and anerror
property.
data
–List Record Collectionerror
–FetchResponse
This code example fetches list view records by API name then iterates through the list of records.
See Also
- Understand the Wire Service
- Handle Errors in Lightning Data Service
- Salesforce Objects Supported by lightning/ui*Api Modules