getPicklistValuesByRecordType
Use this wire adapter to get the values for every picklist of a specified record type.
getPicklistValuesByRecordType
uses this User Interface API resource.
Parameter Name | Type | Description | Required? |
---|---|---|---|
objectApiName | String | The API name of a supported object. | |
recordTypeId | String | The ID of the record type. Use the Object Info defaultRecordTypeId property, which is returned from getObjectInfo . |
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
—Picklist Values Collectionerror
—FetchResponse
Picklist values are scoped to a record type. getPicklistValuesByRecordType
returns a collection of picklist values for all of the picklists of a specified record type. For more information, see Build UI for Picklists.
To retrieve picklist values for a specific field, use getPicklistValues
instead.
See the wireGetPicklistValuesByRecordType
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