getPicklistValues
Use this wire adapter to get the picklist values for a specified field.
getPicklistValues
uses this User Interface API resource.
-
recordTypeId
—(Required) The ID of the record type. Use the Object InfodefaultRecordTypeId
property, which is returned fromgetObjectInfo
. -
fieldApiName
—(Required) The API name of the picklist field on a supported object. -
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.
Using objectApiName
with this wire adapter isn't supported since this information is also already included with fieldApiName
.
data
—Picklist Valueserror
—FetchResponse
Picklist values are scoped to a record type. For dependent picklists, getPicklistValues
returns data for controlling fields and how they map to the picklist. For more information, see Build UI for Picklists.
To retrieve all picklists of a record type, use getPicklistValuesByRecordType
instead.
See the wireGetPicklistValues
component in the lwc-recipes
GitHub repo.
See Also
- Understand the Wire Service
- Handle Errors in Lightning Data Service
- Salesforce Objects Supported by lightning/ui*Api Modules