Develop Secure Code
ui*Api Supported Objects
getObjectInfo
getObjectInfos
getPicklistValues
getPicklistValuesByRecordType
getPicklistValuesByRecordTypeUse this wire adapter to get the values for every picklist of a specified record type.
1import { LightningElement, wire } from "lwc";
2import { getPicklistValuesByRecordType } from "lightning/uiObjectInfoApi";
3import ACCOUNT_OBJECT from "@salesforce/schema/Account";
4
5export default class Example extends LightningElement {
6 @wire(getPicklistValuesByRecordType, {
7 objectApiName: ACCOUNT_OBJECT,
8 recordTypeId: "012000000000000AAA",
9 })
10 propertyOrFunction;
11}1GET /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}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.
@wire, the results are returned to the property’s data property or error property.@wire, the results are returned in an object with a data property and an error property.data—Picklist Values Collectionerror—FetchResponsePicklist 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.
The label property in each returned picklist value is translated into the running user’s language. For details, see Translate Picklist Labels.
Note
See the wireGetPicklistValuesByRecordType component in the lwc-recipes GitHub repo.
See Also
Release Preview